[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: About gcc builtin atomics



On Thu, 21 Jun 2012 19:13:03 +0000 (UTC), Thorsten Glaser <tg@mirbsd.de> wrote:
> /usr/bin/ld: nouveau_dri.so.test: hidden symbol `__sync_sub_and_fetch_4' in=
>  /usr/lib/gcc/m68k-linux-gnu/4.6/libgcc.a(linux-atomic.o) is referenced by =
> DSO
> /usr/bin/ld: final link failed: Bad value
> collect2: ld returned 1 exit status
> make[4]: *** [nouveau_dri.so] Error 1
> make[4]: Leaving directory `/tmp/buildd/mesa-8.0.3/build/dri/src/gallium/ta=
> rgets/dri-nouveau'
> 
> Mikael, I'm not familiar with special rules for hidden symbols,
> but then, the GNU world has been running at a much faster pace
> wrt. shared objects than the BSDs, so that's no surprise - do
> you have an advice what to do to not have such errors?

This linker issue is GCC PR40134.

As I mentioned before you need to replace the libgcc_s.so symlink
with a linker script.  Several gcc targets (at least powerpc, sh,
hppa, and arm) do so already because they have helpers in their
static libgcc that aren't present in their shared libgcc.

On the distro I'm using:
- on an i686 box:
  /usr/lib/gcc/i686-${vendor}-linux/4.6.3/libgcc_s.so is a symlink
  to /lib/libgcc_s.so.1
- on an arm box:
  /usr/lib/gcc/armv5tel-${vendor}-linux-gnueabi/4.6.3/libgcc_s.so
  is a linker script containing
==snip==
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( /lib/libgcc_s.so.1 libgcc.a )
==snip==

You should update gcc/config.gcc to append t-slibgcc-libgcc to
tmake_file for the m68k-*-linux* target before building gcc, and
then adjust whatever your gcc source package does to create the
libgcc_s.so linker script for powerpc/arm to also happen for m68k.

See the patch revisions referenced by GCC PR40134.

/Mikael


Reply to: