Commit Graph

76 Commits

Author SHA1 Message Date
joerg
5df17207d3 R_ARM_TLS_TPOFF32 needs to adjust the existing value, not blindly
overwrite it.
2020-06-16 21:02:20 +00:00
christos
2c62c57fa6 initfini array support for everyone. 2018-12-27 18:58:14 +00:00
joerg
f80c3669c3 Rework ifunc support to address a number of short comings:
- Move to a shared _rtld_call_ifunc for rel and rela architectures
- Architectures using rel format must patch IRELATIVE non-PLT
  relocations like RELATIVE in additition to the later ifunc handling
- Consistently record the delta to the end of the relocation group for
  non-PLT IRELATIVE relocations

Hidden ifunc is now supported on all ifunc platforms, even when using
-fno-plt. The combination of -fno-plt and relro is broken due to
incorrect GNU ld output though.
2018-04-03 21:10:27 +00:00
joerg
da03f1ef14 init/fini for the main program is handled by crt0.o, so ifunc handling
is skipped right now as it iterates the same list. Don't repeat that
mistake and explicitly take care of it in the dynamic linker.
2017-11-06 21:16:03 +00:00
joerg
e78cfb8eb8 Add IRELATIVE support for ARM, X86 and PowerPC. 2017-08-10 19:03:25 +00:00
joerg
6d0511e34f Expand symnum, GCC's uninitialized used tracking is too imprecise. 2017-06-20 12:41:49 +00:00
joerg
fd7c99c412 Drop symbol number from default branch diagnostic, it isn't set at this
point and most likely not valid either.
2017-06-20 11:01:18 +00:00
joerg
e45d4ba084 Replace COMBREL with just-in-time check in _rtld_relocate_nonplt_objects.
The COMBREL logic predates thread-safety of the dynamic linker and
breaks the use of shared locks for the common symbol lookup case. It is
unlikely to provide any benefit for lazy binding or PLT lookups, so
provide equivalent functionality in the non-PLT relocation handling loop
by checking if the symbol used by the current relocation is the same as
the one used during the last lookup. No inter-object cachine is done as
it is also unlikely to be benefical.

Testing with Firefox startup on AMD64 shows a small performance gain by
the new method.
2017-06-19 11:57:01 +00:00
joerg
7a1a6f1cf3 Add basic support for indirect functions. It allows providing a public
function symbol with an implementation choosen at run time.
Refactor calls to functions by address in ld.elf_so to create temporary
function descriptors on the stack, if the address is not leaked outside.

Limitations:
- no support for initialising static storage with function pointers
- no support for unnamed resolver functions

Inspired by FreeBSD's r228435 by kib@freebsd.org.
2014-08-25 20:40:52 +00:00
matt
243b0ccea7 Don't provide __gnu_Unwind_Find_exidx if __ARM_DWARF_EH__ is defined 2014-08-10 23:35:26 +00:00
matt
467f6149c3 Don't use GOT relocations. Use PC relative for the GOT and GOTOFF for
_DYNAMIC.  Make thumb friendly.
2013-12-03 00:19:56 +00:00
matt
25193be039 For earm, emit a MARCH note. 2013-09-10 16:35:10 +00:00
matt
82d2cffc31 Consistently use LDELFSO_MACHINE_ARCH. 2013-05-03 15:52:31 +00:00
skrll
653c73bf56 Remove trailing whitespace 2013-05-03 10:27:05 +00:00
skrll
558553d0e3 Provide a default LDELFSO_MACHINE_ARCH. hi matt!
atf-run works again - the init/fini stuff didn't get run otherwise.
2013-05-03 09:37:17 +00:00
matt
25c44086c9 Changes for MKCOMPAT for earm. 2013-04-27 06:24:22 +00:00
matt
e4c78a6811 Use relocbase, not mapbase. 2013-04-25 13:15:26 +00:00
matt
5417f425b2 Add support for PT_ARM_EXIDX and __gnu_Unwind_Find_exidx for libgcc's support
of the ARM EHABI.
2013-04-24 22:37:20 +00:00
matt
e3feeaa73b Add a ld.elf_so internals version of __gnu_Unwind_Find_exidx for that the
libgcc EHABI can find the exception tables for a supplied PC.
2013-04-24 22:32:29 +00:00
matt
f11367c485 Handle CPUFLAGS being empty 2013-01-23 02:31:54 +00:00
matt
69c1ba57d9 Make sure CFLAGS is not empty. 2013-01-23 02:18:50 +00:00
matt
552187152c If you are using aapcs, you must be using INITFINI 2013-01-22 22:49:09 +00:00
matt
e3dfed33b6 Add .init_array/.fini_array support (conditionalized on HAVE_INITFINI_ARRAY). 2012-08-15 03:46:06 +00:00
matt
4389fd1152 Add a comment for EABI. Use "pop" instructions to save one instruction. 2012-08-13 02:53:25 +00:00
joerg
10dc456d4b Hook up TLS support on ARM. Tested by martin@, kernel support from matt@ 2011-11-18 16:10:02 +00:00
matt
f126fa1c9a Add support for TLS relocations.
From Joerg Sonnenberger
2011-04-12 16:40:04 +00:00
joerg
cb1cd7e860 Add basic locking to ld.elf_so. 2011-03-25 18:07:04 +00:00
joerg
f40b256f09 Reduce header pollution for mdreloc.c. Make Obj_Entry argument of
_rtld_relocate_nonplt_objects non-const in preparation for TLS support.
2010-08-06 16:33:17 +00:00
skrll
15b7ff0199 Make DEBUG build compile. 2010-01-14 12:12:07 +00:00
skrll
c2796a5929 Shut gcc up. 2010-01-14 11:57:06 +00:00
christos
12bd4dbd45 PR/39240: Satoshi Suetake: Don't fail when attempting to resolve weak symbols
when we are doing immediate binding, leave them alone and they will be dealt
with later during lazy binding. From skrll@
2010-01-13 20:17:21 +00:00
skrll
b9fe4e7d17 Add RCSID 2009-11-11 14:15:41 +00:00
jmmv
2cb749c2fd Remove trailing \n in calls to _rtld_error: a newline is automatically
added by a call to the function.
2009-08-29 13:46:54 +00:00
lukem
b4fba76b41 Fix const issues (cast const pointers to "const uint8_t *" instead of "caddr_t")
NOTE: change based on ../i386/mdreloc.c 1.27
XXX: not compile tested
2009-03-16 02:46:47 +00:00
matt
38bdc8954f Refactor common code to _rtld_relocate_plt_object to i386 and arm so they
act like the other versions.
In _rtld_bind, if the result is 0, call _rtld_die.
Initialize _rtld_sym_zero.st_value to -_rtld_objself.maprelocbase.  Now when
the symbol is resolved, st_value + maprelocbase will equal 0 and the above
check in _rtld_bind will fire and a call to NULL will be avoided.
2008-07-24 04:39:25 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
perry
ae6ae2c362 Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:56:41 +00:00
skrll
680596d08e Add __RCSID. 2005-08-20 19:01:16 +00:00
lukem
3ed9ffcae1 Explicitly prefix ld(1) options in LDFLAGS with "-Wl," rather than
using the ${LDFLAGS:@F@-Wl,$F@} make substitution because that breaks
if LDFLAGS is already set.
2005-06-04 16:17:17 +00:00
mycroft
ac7236712a ELF32_ST_TYPE -> ELF_ST_TYPE 2004-12-17 10:53:27 +00:00
rearnsha
3fa803b523 Check the type of symbols; if it's a Thumb function, then set the Thumb
bit in the relocated value (JUMP_SLOT, ABS32 & GLOB_DAT).
2004-08-21 11:14:07 +00:00
rearnsha
c3e148044f Use BX if available. 2004-08-21 11:12:03 +00:00
skrll
d93f13855a Move common LDFLAGS into Makefile from arch/*/Makefile.inc 2004-02-21 15:56:03 +00:00
skrll
151426159b Whitespace. 2004-02-20 20:58:24 +00:00
mrg
88bb1d9b3b include <string.h> or <stdlib.h> for all prototypes 2003-07-26 15:04:38 +00:00
skrll
5f573ab68d ANSIfy and de-__P(). 2003-07-24 10:12:25 +00:00
skrll
ddc9322f3b Support immediate binding on arm. 2003-07-21 15:34:35 +00:00
mycroft
4172074119 Skip the lazy PLT relocation if relocbase==0 (useful if libraries are loaded
at their VMA address).
2002-10-03 20:39:22 +00:00
mycroft
1c495430dd Remove the `self' args to _rtld_relocate_objects() and
_rtld_relocate_nonplt_objects().
2002-09-26 20:42:10 +00:00
mycroft
729925dfb9 Push the _rtld_bind() interface into MD code -- it's just a trivial wrapper
anyway.
2002-09-25 07:27:49 +00:00