summaryrefslogtreecommitdiffstats
path: root/lib/csu/crt0.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ld.so boot cleanup support:guenther2019-05-101-1/+5
| | | | | | | | | | | | | | | | | - put functions and data which are only used before calling the executable's start function into their own page-aligned segments for unmapping (only done on amd64, arm64, armv7, powerpc, and sparc64 so far) - pass .init_array and .preinit_array functions an addition argument which is a callback to get a structure which includes a function that frees the boot text and data - sometimes delay doing RELRO processing: for a shared-object marked DF_1_INITFIRST do it after the object's .init_array, for the executable do it after the .preinit_array - improve test-ld.so to link against libpthread and trigger its initialization late libc changes to use this will come later ok kettenis@
* Call _csu_finish() before {pre,}init_array functions so that in staticguenther2019-05-081-3/+3
| | | | | | | executables the TIB and __progname are set up before they can be used. problem noted by ori@ ok millert@ kettenis@
* Use static consistently with definitions of functions that have beenvisa2019-01-091-2/+2
| | | | | | declared static. OK guenther@
* Add support for {preinit,init,fini}_array sections in static binariesguenther2018-12-211-1/+21
| | | | ok kettenis@
* Pull in declarations for main() and __init() to make clang happy.guenther2017-01-211-1/+2
| | | | | | Mark __init() as hidden ok kettenis@ deraadt@
* MD_START is now always ___start, so expand and eliminate itguenther2017-01-191-5/+2
| | | | ok phessler@ deraadt@
* Now that vax has been removed, nothing defined MD_NO_CLEANUP anymore.kettenis2016-09-261-5/+1
| | | | ok guenther@
* Declare moncontrol(3) APIs in <sys/gmon.h>guenther2016-05-071-4/+3
| | | | | | | Export _gmonparam again. Make gcrt0.o use an reserved name for _monstartup() ok millert@
* Rearrange C runtime bits: now that ld.so exports environ and __progname,guenther2016-03-201-46/+7
| | | | | | | | | | | move their definitions and initialization in static links to libc.a Make crt0 always invoke a new func _csu_finish() in libc to process the auxv and to either register the ld.so cleanup function (in dynamic links) or initialize environ and __progname and do MC_DISABLE_KBIND (in static links). In libc, get pagesize from auxv; cache that between getpagesize() and sysconf(_SC_PAGESIZE) ok mpi@ "good time" deraadt@
* In static binaries, invoke kbind() once to disable it.guenther2015-09-011-3/+6
| | | | | With much assistance from miod@ ok deraadt@@
* Only include "boot.h" if MD_RCRT0_START is defined. Should fix build on vax.kettenis2014-12-271-1/+3
| | | | ok miod@
* Introduce new csu0 variant for -static -pie binaries to use calledkurt2014-12-221-1/+8
| | | | | | | | | | | | | | | | | | 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@
* Fix static linking of libpthread: have crt0 invoke __init_tcb() if it'sguenther2013-12-121-1/+6
| | | | | | defined and we don't think ld.so has already done the TCB setup. ok and much discussion miod@
* Merge the per-arch crt0.c files into common_elf/crt0.c, with MD macros inguenther2013-12-031-0/+121
the md_init.h files. Worked out with and ok miod@; ok matthew@