Re: objtool warnings for kernel/trace/trace_selftest_dynamic.o
From: Andi Kleen
Date: Tue Dec 18 2018 - 18:26:39 EST
On Tue, Dec 18, 2018 at 05:16:20PM -0500, Steven Rostedt wrote:
> On Tue, 18 Dec 2018 14:13:38 -0800
> Andi Kleen <ak@xxxxxxxxxxxxxxx> wrote:
>
> > > Again, that's not the ftrace case. It doesn't care about more than one
> > > out of line instance. Thus, for this particular use, "used" should be
> > > good enough.
> >
> > You mean noinline used?
>
> I thought that someone said that "used" would also prevent inlining.
that's not correct. You need noinline
-Andi
[ak@tassilo tsrc]$ cat tinline.c
int i;
inline __attribute__((used)) int finline(void)
{
i++;
}
main()
{
finline();
}
[ak@tassilo tsrc]$ gcc -O2 -S tinline.c
tinline.c:10:1: warning: return type defaults to âintâ [-Wimplicit-int]
main()
^~~~
[ak@tassilo tsrc]$
[ak@tassilo tsrc]$ cat tinline.s
.file "tinline.c"
.text
.section .text.startup,"ax",@progbits
.p2align 4,,15
.globl main
.type main, @function
main:
.LFB1:
.cfi_startproc
addl $1, i(%rip)
xorl %eax, %eax
ret
.cfi_endproc
.LFE1:
.size main, .-main
.comm i,4,4
.ident "GCC: (GNU) 8.2.1 20181105 (Red Hat 8.2.1-5)"
.section .note.GNU-stack,"",@progbits
[ak@tassilo tsrc]$