Bug 40134 - symbols not resolved when building shared libraries (link with -lgcc_s -lgcc?)
symbols not resolved when building shared libraries (link with -lgcc_s -lgcc?)
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: target
4.4.0
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-13 17:05 UTC by Debian GCC Maintainers
Modified: 2012-06-24 23:27 UTC (History)
3 users (show)

See Also:
Host:
Target: arm-linux-gnueabi
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-05-22 13:37:17


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2009-05-13 17:05:58 UTC
this showed up when trying to address PR40133. Enabling the exception propagation support keeps the __sync_val_compare_and_swap_4 unresolved.

/usr/bin/ld: ./atomic-1.exe: hidden symbol `__sync_val_compare_and_swap_4' in
/home/doko/gcc/4.4/gcc-4.4-4.4.0/build/gcc/libgcc.a(linux-atomic.o) is
referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output

Linking the shared libstdc++ with both -lgcc_s and -lgcc does fix these.

There seem to be two issues:

 - libtool currently doesn't allow to link with -lgcc_s -lgcc (in this order). 
   see http://gcc.gnu.org/ml/libstdc++/2009-05/msg00064.html

 - g++ should link be default with -lgcc_s -lgcc? this is how I understand
   http://gcc.gnu.org/ml/gcc/2009-05/msg00039.html
Comment 1 Matthias Klose 2009-06-20 01:21:49 UTC
The SH port does use a linker script to link with both -lgcc_s and -lgcc.
Comment 2 Debian GCC Maintainers 2009-07-07 09:08:15 UTC
proposed patch at http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00322.html
Comment 3 Matthias Klose 2009-10-19 14:26:40 UTC
Subject: Bug 40134

Author: doko
Date: Mon Oct 19 14:26:28 2009
New Revision: 152975

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152975
Log:
2009-10-19  Matthias Klose  <doko@ubuntu.com>

        PR target/40134
        * config.gcc (arm*-*-linux-*eabi): Use config/t-slibgcc-libgcc.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config.gcc

Comment 4 Matthias Klose 2009-12-04 07:48:08 UTC
Subject: Bug 40134

Author: doko
Date: Fri Dec  4 07:47:51 2009
New Revision: 154973

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154973
Log:
2009-12-04  Matthias Klose  <doko@ubuntu.com>
            John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

        PR target/40134
        * config.gcc (hppa*-*-linux*): Use config/t-slibgcc-libgcc.
        * config/pa/pa-linux.h (LIB_SPEC): Remove.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config.gcc
    trunk/gcc/config/pa/pa-linux.h

Comment 5 Debian GCC Maintainers 2009-12-14 00:21:06 UTC
fixed on the trunk
Comment 6 Matthias Klose 2010-01-04 15:13:39 UTC
Subject: Bug 40134

Author: doko
Date: Mon Jan  4 15:13:08 2010
New Revision: 155617

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155617
Log:
2010-01-04  Mikael Pettersson  <mikpe@it.uu.se>

        PR target/42503

        Backport from mainline:

        2009-09-09  Jakub Jelinek  <jakub@redhat.com>

        * config/t-slibgcc-elf-ver (SHLIB_MAKE_SOLINK, SHLIB_INSTALL_SOLINK):
        New variables.
        (SHLIB_LINK, SHLIB_INSTALL): Use them.
        * config/t-slibgcc-libgcc: New file.

        2009-10-19  Matthias Klose  <doko@ubuntu.com>

        PR target/40134
        * config.gcc (arm*-*-linux-*eabi): Use config/t-slibgcc-libgcc.

Added:
    branches/gcc-4_4-branch/gcc/config/t-slibgcc-libgcc
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/config.gcc
    branches/gcc-4_4-branch/gcc/config/t-slibgcc-elf-ver

Comment 7 Thorsten Glaser 2012-06-24 23:25:53 UTC
Looks like this is needed for all architectures having such symbols in libgcc.a only – I just backported those for m68k to gcc-4.6 and encountered this issue, which Mikael Pettersson helped to solve.
Comment 8 Thorsten Glaser 2012-06-24 23:27:34 UTC
Looks like this is needed for all architectures having such symbols in libgcc.a only – I just backported those for m68k to gcc-4.6 and encountered this issue, which Mikael Pettersson helped to solve.

Just so anyone who’ll encounter these later knows. (Also, rebuild *all* involved DLLs against the libgcc_s.so linker script, not just libstdc++.)