http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52489

             Bug #: 52489
           Summary: LTO drops init_array/fini_array sections
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: lto
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: krisztian.koc...@optimaster.eu


Hi!

When both optimization (-O > 0) and LTO are enabled then init_array and
fini_array sections are missing from the final binary. Without -flto or with
-O0 these sections are not removed.

This prevents building e.g. glibc with LTO (check for init/fini array fails
because the compiled binary does not contain them - I'v checked it by hand
also).

Here is the conftest code:

int _start (void) { return 0; }
int __start (void) { return 0; }
int foo (void) { return 1; }
int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;

CFLAGS: -O2 -flto -static -nostartfiles -nostdlib

This bug may be the same with #51255!

Reply via email to