This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is cross-section inlining valid behaviour?


On Wed, Jul 23, 2008 at 4:46 PM, Bingfeng Mei <bmei@broadcom.com> wrote:
> Hello,
>
> I came across a problem related to cross-section inlining. For the
> following example,
>
> static void foo(void) __attribute__((section ("foo")));
>
> static void foo(void)
> {
>  printf("Hello\n");
> }
>
> void bar(void) __attribute__((section ("bar")));
>
> void bar(void)
> {
>  foo();
> }
>
>
> I compiled with the latest mainline gcc.
> gcc tst.c -O3 -S
>
>
> The foo function is inlined into bar anyway even they have different
> section attribute.  Is this a bug or expected behaviour?

This is expected behavior.

Richard.

>        .file   "tst.c"
>        .section        .rodata.str1.1,"aMS",@progbits,1
> .LC0:
>        .string "Hello"
>        .section        bar,"ax",@progbits
>        .p2align 4,,15
> .globl bar
>        .type   bar, @function
> bar:
> .LFB3:
>        movl    $.LC0, %edi
>        jmp     puts
> .LFE3:
>
>
> Thanks.
> Bingfeng Mei
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]