Gold linker support for entire source tree
This commit is contained in:
@@ -45,7 +45,11 @@ M= ${.CURDIR}/arch/${ARCHSUBDIR}
|
||||
|
||||
LDFLAGS+= ${${ACTIVE_CC} == "clang":? -Wl,-Bsymbolic : -symbolic} \
|
||||
-shared -nostartfiles -nodefaultlibs
|
||||
.if defined(__MINIX) && ${HAVE_GOLD:U} != ""
|
||||
LDFLAGS+= -Wl,--script ${LDS_SHARED_LIB}
|
||||
.else
|
||||
LDFLAGS+= -Wl,-static
|
||||
.endif
|
||||
LDFLAGS+= -Wl,--warn-shared-textrel
|
||||
|
||||
COPTS+= -fvisibility=hidden
|
||||
|
||||
@@ -46,6 +46,17 @@
|
||||
leal _DYNAMIC-1b(%edx),%ecx # &_DYNAMIC
|
||||
movl %ecx,%ebx
|
||||
subl _GLOBAL_OFFSET_TABLE_-1b(%edx),%ebx
|
||||
#ifdef HAVE_GOLD
|
||||
/* Adjust the offset when using the gold linker, because it's off.
|
||||
* Using '_DYNAMIC' this way produces the warning
|
||||
* 'shared library text segment is not shareable', produced by '--warn-shared-textrel'
|
||||
* to avoid the warning, add a '_MY_DYNAMIC = .;' before the dynamic section in the
|
||||
* linkerscript that is used, and replace '_DYNAMIC' with '_MY_DYNAMIC' here.
|
||||
* However, this way, you end up with a custom linker script that you have to maintain.
|
||||
*/
|
||||
leal _DYNAMIC,%eax
|
||||
subl %eax,%ebx
|
||||
#endif
|
||||
|
||||
pushl %ebx # relocbase
|
||||
pushl %ecx # &_DYNAMIC
|
||||
|
||||
@@ -344,7 +344,7 @@ _rtld_init(caddr_t mapbase, caddr_t relocbase, const char *execname)
|
||||
#else
|
||||
_rtld_relocate_plt_objects(&_rtld_objself);
|
||||
#endif
|
||||
#if !defined(__mips__) && !defined(__hppa__)
|
||||
#if !defined(__mips__) && !defined(__hppa__) && !defined(HAVE_GOLD)
|
||||
assert(!_rtld_objself.pltgot);
|
||||
#endif
|
||||
#if !defined(__arm__) && !defined(__mips__) && !defined(__sh__)
|
||||
|
||||
Reference in New Issue
Block a user