summaryrefslogtreecommitdiff
path: root/lib/csu
AgeCommit message (Collapse)Author
2015-01-16<sys/param.h> is not needed here either.Theo de Raadt
ok guenther millert doug
2015-01-01Inline the .cpsetup pseudo-statement in rcrt0 to avoid saving the "old" gpMiod Vallat
value, which we have no use for. ok kettenis@
2014-12-30self-relocating crt0 bits for sh, and enable static pie by default. With someMiod Vallat
archdep.h help from kettenis@
2014-12-29Make the PLT read-only on powerpc as well.Mark Kettenis
ok kurt@
2014-12-27Static PIE for mips64. Still something not quite right as a full make buildMark Kettenis
fails. ok kurt@
2014-12-27Only include "boot.h" if MD_RCRT0_START is defined. Should fix build on vax.Mark Kettenis
ok miod@
2014-12-27Static PIE support for alpha.Mark Kettenis
This adds alpha-specific first-pass GOT relocation code to boot.h. The assembly code is pure magic. The numeric register names don't make it easier to understand (or compare with the equivalent ld.so code). Unfortunately the assembler only understands a few symbolic register names. Renames the crt0.o entry point to __start. Our compiler was already using __start and the linker will soon follow. ok kurt@
2014-12-26Self-relocation code for powerpc.Kurt Miller
2014-12-25Use archdep.h GOT_PERMS define for mprotect of GOT. okay kettenis@Kurt Miller
2014-12-24Expand Elf_Rel relocations to include DT_JMPREL. Inspect DT_PLTREL valueKurt Miller
to determine if DT_JMPREL relocations are REL or RELA and conditionally perform DT_JMPREL in either REL or RELA as needed (idea from kettenis@). Remove unneeded i386 RELA implementation. i386 static pie working now. okay kettenis@
2014-12-24Fix previos. Pointed out by kurt@.Mark Kettenis
2014-12-23Use the page size passed by the kernel in the Auxilliary Vector to handleMark Kettenis
architectures with variable page size.
2014-12-23Make sure the GOT and PLT are not writable.Mark Kettenis
Note that ommitting PROT_EXEC for the PLT is deliberate; static PIE binaries should never actually hit the PLT. We're still debating what to do when mprotect(2) fails. But that is no excuse not to at least attempt to fix things up. ok deraadt@
2014-12-23do not expose "ra" to cpp because it muddles up the .c code above.Theo de Raadt
instead handle it internally as $ra solution from kettenis, ok guenther
2014-12-23Set up the linkage table register (%r19) before calling _dl_boot_bind.Mark Kettenis
2014-12-22Self-relocation code for i386.Kurt Miller
2014-12-22Self-relocation code for hppa.Mark Kettenis
2014-12-22Self-relocation code for sparc64.Mark Kettenis
2014-12-22When skipping a relocation because the referenced symbol is undefined, makeMark Kettenis
sure we move on to the next relocation entry. While there, also skip relocations for REL architectures.
2014-12-22Introduce new csu0 variant for -static -pie binaries to use calledKurt Miller
rcsu0.o where the initial 'r' is for relocatable. rcsu0.o performs self-relocation on static pie binaries by calling a slightly modified copy of ld.so's _dl_boot_bind() in boot.h. The first arch implementatation is also included for amd64 where __start calls _dl_boot_bind() and then calls ___start(). Includes parts from kettenis@ to help get R_X86_64_64 relocations working and proper handling for undefined weak symbols. This is the first part of several to get static pie self-relocating binaries working. binutils, gcc and kernel changes are forthcoming to complete the solution, then per-arch implementations are needed for MD_RCRT0_START in csu. okay kettenis@ pascal@ deraadt@
2014-11-22mop up a barely started project... getting in the way of grepping the tree!Theo de Raadt
2014-11-15Objects for the executable can be PIE instead of PIC, so remove the sparc64Philip Guenther
special case; no binary change ok kettenis@
2014-11-15ELF uberalles, so move the files up out of common_elfPhilip Guenther
ok miod@ deraadt@
2013-12-28Move atexit(3) into crtbegin.c and certbeginS.c such that we can pass theMark Kettenis
right __dso_handle and have dlopen'ed shared objects run their atexit handlers when they get unloaded. This is what Linux does, and several ports depend on this behaviour (and will crash upon exit without this chang). Based on an earlier diff from matthew@ Tested by ajacoutot@ ok deraadt@
2013-12-12Fix static linking of libpthread: have crt0 invoke __init_tcb() if it'sPhilip Guenther
defined and we don't think ld.so has already done the TCB setup. ok and much discussion miod@
2013-12-03Merge the per-arch crt0.c files into common_elf/crt0.c, with MD macros inPhilip Guenther
the md_init.h files. Worked out with and ok miod@; ok matthew@
2012-12-05Remove excessive sys/cdefs.h inclusionTheo de Raadt
ok guenther millert kettenis
2012-09-08Reverse the order that ctors and dtors are run in accordance withMatthew Dempsky
GCC's documentation. Fixes GNU C++'s init_priority attribute. ok miod
2012-08-28Add __guard_local as a hidden symbol to ld.so, kernel, and everyMatthew Dempsky
executable and DSO (via crtbegin.c/crtbeginS.c). Not used yet, but needed before GCC can start emitting -fstack-protector code that uses them instead of __guard.
2010-05-01Sprinkle a few __used markers to prevent gcc4 from throwing away essentialMark Kettenis
bits of code and data. With this change gcc4 builds usable crt*.o on sparc64, other architectures probably need some more love. ok marco@, jsg@
2009-07-14Don't specify mode(SI) attribute for __EH_FRAME_END__ as we haveJonathan Gray
32 bit ints on OpenBSD. ok kettenis@
2009-04-13Add gcj java class registration hooks for gcc3 elf archs. From NetBSDKurt Miller
with minor differences. okay kettenis@ drahn@
2009-03-06Work-around a gcc3 -g bug causing debug ld.so to crash.Kurt Miller
okay kettenis@ drahn@
2009-02-04Tag ELF shared libraries as OpenBSD.Mark Kettenis
ok kurt@, drahn@, miod@
2007-09-03Add __cxa_atexit() support for gcc3. This provides support for shared ↵Todd C. Miller
object destructors called at dlclose() time. Inspired by similar changes in FreeBSD and NetBSD.
2004-10-26Change __register_frame_info into a weakly defined symbol.Mark Kettenis
ok drahn@, pval@, deraadt@
2004-10-10Add support for DWARF2 exception handling.Mark Kettenis
ok drahn@, millert@
2004-01-26add finalized guard to destructor calls, to prevent multiple calls.Marc Espie
stop most kde apps from burping all over the place on exit, which means that, somehow, our destructors get registered twice... :-( Okay drahn@
2004-01-26small clean-up: typedef to desambiguate const, prototypes...Marc Espie
ok drahn@, some time ago.
2004-01-08__init/__fini handling on ELF has not been correct. It is supposed toDale Rahn
be a section which code stubs (branches) can be added to initialize/destructor This adds MD stubs to allow this to operate as expected. should fix wine and behave according to ELF specs. ok miod@
2003-12-28correct array initializer size to be [1], not [0] fixes gcc3 libstdc++ errorDale Rahn
ok espie, millert
2003-11-22remove multi-line literals in __asm syntax to keep gcc3 happyAnil Madhavapeddy
henric@ henning@ ok
2003-06-26boring protosTheo de Raadt
2003-03-31add a newline at end of file. gcc3 rightfully complains if the fileBruno Rohee
is not newline terminated. From Thorsten Glaser
2002-02-16Part one of userland __P removal. Done with a simple regexp with some minor ↵Todd C. Miller
hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
2001-05-28Commonize csu code for elf systems, powerpc now no longer has it's ownDale Rahn
versions of these files. Fixed a bug in ld.so in this, instead of scheduling the fini of each of the shared libraries with atexit. schedule a function of ld.so itself and it will walk all of the open libraries when the program exits. otherwise a shared library could be dl_open()ed and then dl_close()d and then it would not be mapped for the atexit processing. TODO: What if atexit is not found (process did not link against libc?) Do shared libraries that are dl_closed have their global destructors run?
2001-02-03oops.Artur Grabowski
2001-02-03Schedule running of __fini in __init, not __start.Artur Grabowski
2001-02-03An OpenBSD tag doesn't hurt.Artur Grabowski
2001-02-03Add an OS note identifying OpenBSD binaries.Artur Grabowski
This appears to be the standard way to do it.