summaryrefslogtreecommitdiff
path: root/lib/csu
AgeCommit message (Collapse)Author
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.
2001-02-03Decruftification.Artur Grabowski
2001-02-03Create a common_elf directory with crtbegin and crtend that canArtur Grabowski
be shared between archs.
2014-11-12Merge Makefiles, moving the build up a level and putting the CPU-specificPhilip Guenther
build flags into conditionals in the Makefile, fixing a few inconsistencies in the process. \o/ miod@
2014-11-10m68k is dead <sniff>Philip Guenther
ok miod@
2014-04-18It's been a quarter century: we can assume volatile is present with that name.Philip Guenther
2014-02-22Increase _STACKALIGNBYTES to 15 (was 7), and make sure the stack is alignedMiod Vallat
to a 16 byte boundary in csu (similar to what the other arches where _STACKALIGNBYTES != _ALIGNBYTES do). This is necessary for long double variables on the stack to be correctly aligned.
2014-01-14build crt*S with -fPIC instead of -fpicMiod Vallat
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-23Add assembly code to set up the arguments for the common C startup code. ThisMark Kettenis
means we no longer rely on how the C compiler sets up the initial stack frame and allows us to get rid of MD_NO_CLEANUP. ok deraadt@, guenther@
2013-12-23Sync Makefile with what other platforms do; makes dependency tracking actuallyMark Kettenis
work. ok deraadt@, guenther@
2013-12-20Fix typo, allow hppa64 to build a little furtherTobias Ulmer
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-04correct frame handlingTheo de Raadt
with and ok guenther
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@
2006-10-10Preliminary userland bits for OpenBSD/landisk, many things coming fromMiod Vallat
NetBSD.
2013-12-01mips64 no longer uses scrt0.o, and it was identical to crt0.o anyway.Philip Guenther
Delete unused #ifndef SCRT0 conditionals. ok miod@
2013-11-10The kernel and ld.so have passed 0 in r0 for use as the cleanupPhilip Guenther
callback for about a year, so it's safe to make __start() pass that as the cleanup argument to ___start(), and have *that* conditionally pass it to atexit(). Eliminate the no-longer-used obj and ps_strings arguments to position things correctly, simplifying the ASM wrapper slightly. ok kettenis@ miod@; testing patrick@
2013-11-10The kernel and ld.so have passed 0 in r7 for use as the cleanupPhilip Guenther
callback for about a year, so it's safe to make __start() treat that as the cleanup argument and conditionally pass it to atexit(). Eliminate the no-longer-used obj and ps_strings arguments to position things correctly, which lets us eliminate the ASM wrapper completely. ok kettenis@ miod@
2013-11-10The kernel and ld.so pass 0 in %rdx for use as the cleanup callbackPhilip Guenther
for about a year, so it's safe to add the test and atexit() call. While here, drop the no-longer-used obj and ps_strings and the asm to set those up, switch from sys/param.h to limits.h, and ANSIfy. ok kettenis@