https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61395

            Bug ID: 61395
           Summary: Linker cannot find symbols in object files compiled
                    with recent GCC
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mimamer at gmail dot com

Apologies in advance for any mistakes in posting this bug report. If what I am
describing is not a bug in GCC please direct me to a place where I can ask for
help on this issue -- thanks!

I recently upgraded from GCC 4.3.4 to 4.9.0, which I set up as a cross compiler
from i686-pc-cygwin to i686-pc-elf together with static and shared libgcc
support. I created a shared libgcc.so version from libgcc.a using 'ld' and
specifying --whole-archive (as well as the other usual flags). Now, when I try
to link even a very simple test program that emits a symbol defined in a shared
library such as libgcc.so the link step fails with GCC/ld complaining that the
symbol (e.g., __divdi3) cannot be found. I can verify that the symbol is
available in libgcc.so's .symtab (as FUNC LOCAL DEFAULT 12) and specified in
main.o's .symtab (as NOTYPE GLOBAL DEFAULT UND), yet when I try to link main.o
with -lgcc (or libgcc.so) I get "Undefined reference to `__divdi3'". Upgrading
the linker did not have any effect. I can also verify that the linker finds all
input files in the right places, so I am completely at lost what is going wrong
here, and though I suspect a compiler bug (since this did work for me with GCC
4.3.4) I may easily be wrong. Apologies again!

Reply via email to