Commit Graph

924 Commits

Author SHA1 Message Date
matt 22fbc67ed0 Don't resolve symbols to PLT entries on the VAX. It just causes a lot of
overhead.
2014-03-21 01:40:41 +00:00
joerg f8bf5bbce0 Save actual start of function, not address of entry mask on the stack. 2014-03-19 21:52:00 +00:00
matt f71aaf7afb Fix two bugs. (jump past entry mask, fix insv) 2014-03-19 15:34:30 +00:00
matt db747c73e4 Once we know the bound routine, rebuilt a new callframe that can be unwound
properly.
2014-03-19 02:39:22 +00:00
matt bf06b1032e Add .cfi ops so that one can unwind through this. 2014-03-18 23:43:38 +00:00
riastradh 6cb10275d0 Merge riastradh-drm2 to HEAD. 2014-03-18 18:20:35 +00:00
joerg 47875e291b Ignore LD_BIND_NOW for setuid binaries, but keep it in the environment
otherwise.
2014-03-18 16:05:34 +00:00
matt cdbe3bab4f Change OUTPUT to powerpc:common to make powerpc64 ld happy 2014-03-07 05:57:46 +00:00
matt 9b490ebf92 Make ldd happy 2014-03-07 01:27:14 +00:00
matt 1200e7d3fe More PPC64 changes.
Nothing to do for lazy bindings.
Record DT_PPC64_GLINK and make _rtld_bind return it.
When resolving a JMP_SLOT, copy the source function descriptor into the PLTGOT
2014-03-06 19:19:40 +00:00
matt 15089cc505 Enable building ld.elf_so for powerpc
Produce a link map for ld.elf_so
2014-03-06 09:34:56 +00:00
matt 565a18129d Make ELF64 aware. 2014-03-06 09:34:07 +00:00
matt fab57a4af5 powerpc64 changes 2014-03-06 07:47:39 +00:00
matt 746070937f Startup file for powerpc64. (too many difference with ppc32 to do
#ifdef dance)
2014-03-06 07:47:19 +00:00
joerg 15f3733bef Catch up with _lwp_park change. 2014-01-31 22:46:40 +00:00
joerg cb2eb1a336 Don't align random sections. Simplify by using .pushsection/.popsection. 2014-01-12 19:36:08 +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
christos 5fbbc292aa CID 1132773: Fix file descriptor leak 2013-11-27 18:01:33 +00:00
skrll 03ee7fc3bc If dlopen of the dynamic linker is requested, e.g. by rump in
rumpuser_dl_bootstrap, then return &_rtld_objself as the handle and do
not create a duplicate mapping.

The handle is mostly useless as _rtld_objself doesn't appear on
_rtld_objlist.

This fixes a problem on earm platforms where ld.elf_so (currently) has
an init_array section.  Calling this caused binaries to segv.
2013-11-20 07:18:23 +00:00
skrll 90c0a95fec Remove hack now it's fixed in 4.8.2 2013-11-16 17:14:06 +00:00
skrll 283152d4ee Apply hack for gcc 4.8 bug on rtld.c. 2013-11-13 11:06:53 +00:00
joerg 5e2fc1bbd3 Only initialise TLS space from the PT_TLS segment, if the size is
positive and the offset has been computed. Fixes PR lib/48324.
2013-10-21 19:14:15 +00:00
christos 193b880fad fix unused variable warnings 2013-10-19 17:19:30 +00:00
skrll 3ea7549453 Add debug code. 2013-10-19 10:14:06 +00:00
matt fa741d8823 Use MACHINE_CPU for m68k. Use similar logic for both tests. 2013-10-09 22:33:41 +00:00
martin abea8b316b The R_SPARC_L44 relocation type is documented to be truncating and
calculated as "(S + A) & 0xfff" - so while it (usually) sets a "imm13" field
in the opcode, only 12 bits of the calculated value can be used.
2013-10-03 10:45:57 +00:00
martin c60b2e0b87 Missing , in table initializer 2013-09-23 21:00:35 +00:00
matt 25193be039 For earm, emit a MARCH note. 2013-09-10 16:35:10 +00:00
joerg a6c6eb019c Some architectures can't create unwind tables without the frame pointer,
so don't use -fomit-frame-pointer on those.
2013-08-12 17:15:46 +00:00
skrll ffcdb0b170 Fix DEBUG build. 2013-08-03 13:17:05 +00:00
matt 8b8f566d0a Support MACHINE_ARCH of coldfire 2013-07-18 21:58:13 +00:00
matt 36677b4016 Use new macros from <machine/asm.h> to be more portable 2013-07-18 21:57:42 +00:00
matt d28e4d0aac Simplify ELFSIZE by using _MIPS_SZPTR 2013-07-10 15:08:38 +00:00
skrll 1f32502b56 Remove redundant assignment. Hasn't been needed since 1999. 2013-05-09 15:47:34 +00:00
christos c188b90222 remove stray debugging 2013-05-09 15:39:10 +00:00
christos 3c085045e3 convert to SIMPLEQ like the rest of the queues. 2013-05-09 15:38:14 +00:00
christos a3f195d87d Fix refcount of the object we found in our list by name. 2013-05-09 15:37:58 +00:00
skrll 9b98bab04b Fix debug symlink 2013-05-09 11:44:36 +00:00
christos ea2a3471f1 provide debug symlink. 2013-05-08 15:33:45 +00:00
christos e269a2149a need xfree() instead of free(). Using free() ends us up in an infinite loop. 2013-05-08 15:25:01 +00:00
christos 558b540714 we don't need the versioning stuff for ldd 2013-05-07 13:01:07 +00:00
christos 5e59dafbb3 don't overwrite COPTS 2013-05-06 22:49:10 +00:00
christos a3fedff4d1 Fixed handling of DT_SONAME:
- add function to add name aliases for shared libraries loaded
	  XXX[1]: we don't add a name during load time, only when DT_SONAME
	  is present.
	- search already loaded objects in load_by_name for an already
	  loaded object that matches our name and return it.
	- add missing initialization and cleanup for obj->names
	  XXX[2]: should we make them SIMPLEQ?
	- Add XXX in rtld.c about getting the name of an object.

NB: This makes the jdk work again without resorting to a hack of putting
    the build path of libjvm.so into the run path (which is a security
    problem).
XXX: Pullup-6?
2013-05-06 19:59:29 +00:00
skrll b49eab8ee4 Trailing whitespace 2013-05-06 08:02:20 +00:00
skrll 5aa71ff59a Disalble a debug only where it causes problems. 2013-05-06 07:58:43 +00:00
skrll 144fe47c93 Add some DEBUG code. 2013-05-06 07:54:04 +00:00
matt d631499dcf Remove dbg for _ctype_ 2013-05-03 18:31:24 +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 5d1d1ac212 Print out &_DYNAMIC too. 2013-05-02 21:11:18 +00:00
matt 6b1442b03a Print out PT_DYNAMIC address for objmain.
Print out &_DYNAMIC too.
2013-05-02 21:11:03 +00:00
matt 25c44086c9 Changes for MKCOMPAT for earm. 2013-04-27 06:24:22 +00:00
matt 3498abfd33 Use __printflike and __dead instead of __attributes__ 2013-04-25 14:16:37 +00:00
matt 0504785998 Use phdr as start of phdrs (duh) 2013-04-25 13:45:15 +00:00
matt f0744dd4e8 Use ph, not phdr, consistently. 2013-04-25 13:26:17 +00:00
matt e4c78a6811 Use relocbase, not mapbase. 2013-04-25 13:15:26 +00:00
matt b469c1cb35 Don't assume that PT_PHDR is always first. 2013-04-25 13:14:41 +00:00
skrll afe1984da4 Adjust exidx_start by relocbase 2013-04-25 12:28:59 +00:00
skrll d4d42c7f62 Handle PT_ARM_EXIDX when mapping objects. 2013-04-25 09:01:23 +00:00
matt 44eef346cd Only include unwind.h if _RTLD_SOURCE 2013-04-25 06:37:40 +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
christos f903624708 split debug info for rtld 2013-04-05 20:16:40 +00:00
christos f7f3399458 don't free cp before we copy it! 2013-01-24 17:57: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
dsl c8b3cc05d4 Fix the other lwp_park() to pass 0 for the 'unpark' lwp. 2012-12-16 23:00:46 +00:00
dsl 1ba527af78 You need to pass 0 (not -1) to lwp_park() if you don't also
want to do an unpark.
Clearly this code path was never tested!
Needs pullup to netbsd-6
2012-12-16 11:15:21 +00:00
apb 6e8c6cbb85 Add support for R_386_TLS_TPOFF32. This patch was created by
Nick Hudson for PR 47061.
2012-11-07 07:24:46 +00:00
dholland 9d2c006837 Improve the diagnostic messages for invalid/non-ELF files. Proposed a
while back; I forget the context. Has been sitting in one of my trees
awaiting a test run since, apparently, August 2011.
2012-10-13 21:13:07 +00:00
riastradh 6f24a346a4 On failure in _rtld_dlcheck, call _rtld_error, not xwarnx.
Callers need not call _rtld_error themselves now.

Fixes PR lib/41760.  Should add the test case from the PR too.
2012-10-01 03:03:46 +00:00
joerg 067600c8cf Revert last, it breaks the tricks xsrc uses. 2012-08-23 21:21:14 +00:00
joerg 8e96262375 Remove SHLIBINSTALLDIR and SHLINKINSTALLLIBDIR. Add rpath entries, if
SHLIBDIR differs from /usr/lib.
2012-08-23 15:45:02 +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
matt e43469a595 Don't abuse DBG, use COPTS instead. 2012-08-04 15:17:16 +00:00
martin 972dd84db2 Try to make dbg() printfs realy ELFSIZE independent 2012-07-25 22:51:04 +00:00
martin 0180ae1c0a Add special handling needed for OLO10 relocations.
First part of fixing PR port-sparc64/46724.
2012-07-22 09:21:03 +00:00
martin e97494f3ca Remove a debug assert that does not hold for PIE (e.g. phdr = 0x40, but
obj has not been mapped at 0, so obj->phdr is 0x100040).
OK: skrll
2012-07-22 09:16:35 +00:00
joerg ba562931eb This version of __diagssert13 is dead. 2012-03-16 11:44:54 +00:00
christos 749108f9b9 Add __diagassert13() so that if libc is compiled with _DIAGNOSTIC, it does
not end up bringing in all of stdio.
XXX: This is temporary.
2012-03-15 00:16:07 +00:00
joerg 8ae54e9304 Mark _rtld_debug_state as not to be inlined. Add an explicit instruction
barrier to prevent removal of calls to it.
2012-03-13 21:00:31 +00:00
joerg 52a4c27e3e Add _dlauxinfo helper function to provide access to the ELF auxilary
vector. This can normally be found via __ps_strings, but libc is
initialised too early when linked dynamically and doesn't have access to
it yet, so provide an alternative mechanism via ld.elf_so.
Bump libc minor.
2012-02-16 23:00:38 +00:00
skrll 1b54bd1886 Implement lazy binding on hppa. rump_server needs it!?!?!
Mostly from OpenBSD.
2012-01-06 10:38:56 +00:00
joerg e86a1635be Align in the stack before calling _rtld in the way the x86_64 ABI
specifies. This is necessary to ensure that init functions are always
called with the correct alignment, e.g. in case they use SSE
instructions.
2011-12-11 22:07:26 +00:00
joerg 934a3ac455 Mark xassert as __dead 2011-12-11 11:05:11 +00:00
skrll df83e35987 Remove unused file. 2011-12-05 07:36:32 +00:00
skrll 248fe9e5bd Use the tlsoffset from the correct object. 2011-12-04 16:53:08 +00:00
skrll 8737e6c85f Restore backwards compatibility by removing unnecessary addition of
dlvsym to Obj_Entry.

Add some comments.
2011-12-02 09:06:49 +00:00
joerg 5b3faf1c05 Unbreak RTLD_NEXT and co on platforms that don't inline or tail call
do_dlsym.
2011-11-25 21:27:15 +00:00
joerg 7878f85385 Replace if() NADA else if() NADA else continue logic with one explicit
block. Split out the MIPS handling to make it explicit and readable.
2011-11-25 14:39:02 +00:00
joerg 6133e96c53 Add TLS support for m68k. 2011-11-22 15:25:28 +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
joerg cc2f98ece2 FreeBSD bug report 161344: TLS area for the main thread is set up to
early, if e.g. pointers to functions are used as initializers.
2011-11-17 16:20:11 +00:00
chs d7bbed6455 avoid linker warnings with the new binutils by not forcing ld.elf_so
to be soft-float.  the floating-point usage in ld.elf_so is only
because of stdarg functions like printf(), and gcc 4.5 is good
about not actually executing the FP instructions in such functions
unless FP values are passed to them, which ld.elf_so doesn't do.
2011-10-26 15:56:58 +00:00
christos 1f1b5ad097 Don't block SIGTRAP so that on architectures where the debugger needs to
be able to receive sigtrap for breakpoints to work, it can. For example
we are setting breakpoints inside dlopen(), after we've blocked the signal,
so the process keep trapping and looping over the trap instruction without
being able to send the signal. Another way would be to move the
_rtld_debug_state() calls outside the critical section...
2011-10-23 21:06:07 +00:00
mrg 4a9d1308c3 obsolete libgcc_pic and friends. all libgcc's are supposed to be pic
for platforms with shlibs already (and are.)

this obsoletes our hacks for the libgcc specs to use libgcc_pic, and
fixes a couple of other issues reported to me directly.
2011-10-07 09:15:21 +00:00
mrg 1862dafe3f match EXIT() with LEAF_ENTRY() so that sizes are actually constants.
fixes binutils 2.21 build issues reported by he and chuq.
2011-09-30 03:05:43 +00:00