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

             Bug #: 52990
           Summary: bootstrap ia64 cross-compiler gcc (static C-only)
                    includes a broken libgcc.a due to libunwind
                    dependencies
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: vap...@gentoo.org
                CC: toolch...@gentoo.org
            Target: ia64-linux-gnu


when building up a cross-compiler for ia64, we do:
 - install binutils
 - install kernel/C-library headers
 - build a static C-only gcc compiler
 - install glibc
 - try to link a static ELF -> failure

this is due to libgcc on ia64 being dependent on libunwind symbols.  when
shared libs are disabled, the libgcc.a ends up referring to __libunwind_xxx
symbols which aren't provided in the non-shared case.

specifically, we have:
 - ia64 forces t-unwind in config.gcc which adds -DUSE_LIBUNWIND_EXCEPTIONS
 - gcc/unwind-compat.c has a bunch of extern __libunwind_xxx decls
 - libgcc/Makefile.in adds unwind-compat.o to libgcc.a when enable_shared!=yes
 - gcc/config/ia64/unwind-ia64.c defines __libunwind_xxx aliases when SHARED
 - unwind-ia64.o is only added to libunwind.{a,so} and never libgcc.a

so, the end libgcc.a gets unwind-compat.o which refers to __libunwind_xxx, but
doesn't get unwind-ia64.o which could possibly define them, and even if it did,
the aliases aren't enabled for static objects.

looks like we could fix this in the t-glibc-libunwind file, when enable_shared
is disabled, add the ia64 unwind objects to libgcc.a.  additionally, have
unwind-ia64.c key off of not just SHARED but also STATIC_ONLY for declaring the
symbols, and have the t-glibc-unwind file build unwind-ia64.o with that.

Reply via email to