Linux linker errors with binutils >= 2.27
Marco Leise via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 5 12:19:11 PDT 2017
Am Wed, 5 Jul 2017 22:14:47 +0300
schrieb ketmar <ketmar at ketmar.no-ip.org>:
> Marco Leise wrote:
>
> > Since binutils 2.27 I can not compile dmd with the `gold`
> > linker any more. On my Gentoo Linux amd64 host, when linking
> > the 32-bit version of druntime the following error is
> > repeatedly output for all kinds of symbols:
> >
> > libdruntime.so.a(libdruntime.so.o):
> > relocation R_386_GOTOFF against preemptible symbol <some
> > mangled name> cannot be used when making a shared object
> >
> > Now starting with binutils 2.28 - in addition to the above -
> > dynamically linked Dlang executables error out in druntime
> > with an error message of this type:
> >
> > Fatal Error while loading '/usr/lib64/libphobos2.so.0.74':
> > The module '<some module>' is already defined in '<executable>'.
> >
> > Does anyone have solutions to one or both of these issues at
> > hand? For Gentoo packages I made shared linking the default
> > and unless my configuration is a unique snowflake this is
> > right now affecting all DMD users there.
> > From reading `checkModuleCollisions()`
> > [https://github.com/dlang/druntime/blob/master/src/rt/sections_elf_shared.d#L891]
> > it would seem that changes in copy-relocations have something
> > to do with the second issue it.
>
> 1. patch your compiler to use old ELF_COMDAT hack in elfobj.c:
> #define ELF_COMDAT TARGET_LINUX
> +#undef ELF_COMDAT
> +#define ELF_COMDAT 0
>
> 2. downgrade to old binutils, new binutils are not working with dmd .so's.
>
> step "2" is essential. alas.
That information is gold, ketmar!
--
Marco
More information about the Digitalmars-d
mailing list