summaryrefslogtreecommitdiffstats
path: root/lib/csu/amd64 (follow)
Commit message (Collapse)AuthorAgeFilesLines
* crt0 MD _dl_exit() performs syscall to SYS_exit directly, but thenderaadt2020-10-151-6/+2
| | | | | | | | | | | some of these functions were returning. That makes the +1word address a fairly strong and easily located gadget. Put a hard-trap instruction after the syscall. This remains a gadget for 'terminal system' calls (such as execve), but hey that's why we have pledge w/o "exec" throughout the tree. Quite surprisingly, hppa's delay-slot load of SYS_exit makes it the safest of the bunch, not that this helps anyone. ok kettenis
* use symbolic SYS_exit instead of the value 1deraadt2020-10-141-3/+2
| | | | ok kettenis
* Rearrange C runtime bits: now that ld.so exports environ and __progname,guenther2016-03-201-9/+1
| | | | | | | | | | | 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-2/+8
| | | | | With much assistance from miod@ ok deraadt@@
* Introduce new csu0 variant for -static -pie binaries to use calledkurt2014-12-221-1/+46
| | | | | | | | | | | | | | | | | | 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@
* Merge Makefiles, moving the build up a level and putting the CPU-specificguenther2014-11-121-61/+0
| | | | | | | build flags into conditionals in the Makefile, fixing a few inconsistencies in the process. \o/ miod@
* Merge the per-arch crt0.c files into common_elf/crt0.c, with MD macros inguenther2013-12-033-124/+25
| | | | | | the md_init.h files. Worked out with and ok miod@; ok matthew@
* The kernel and ld.so pass 0 in %rdx for use as the cleanup callbackguenther2013-11-101-11/+6
| | | | | | | | 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@
* Pass install the -S option to avoid a window where the target isn'tguenther2011-11-081-2/+2
| | | | | | | executable (by mode or content), which can trip up builds with 'make -j' (The generic fix is in share/mk/*; some Makefiles have their own INSTALL lines) ok millert@ deraadt@
* Make sure everything run from .init and .fini sections gets a properly alignedkettenis2011-03-301-2/+3
| | | | | | stack. ok deraadt@, fgsch@
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-271-2/+2
| | | | | | | unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
* Compile crt0.o, crtbegin.o and crtend.o with -fpie/-fPIE. This requireskurt2008-11-111-7/+7
| | | | | | gcc with pie support to be built first. ok kettenis@
* The recent change to bsd.own.mk to allow PICFLAG to be overridden madekurt2008-10-061-3/+1
| | | | | | | these previously ignored PICFLAG settings become active. Remove PICFLAG overrides to restore -fpic/-fPIC modes. In snaps for a week. okay drahn@
* Remove separate pic versions of crt0, crtbegin, crtend. Nextkurt2008-07-281-21/+2
| | | | | | release we are taking a different approach. Idea from kettenis@. okay kettenis@ weingart@
* Build pic versions of crt0, crtbegin & crtend for amd64, i386, powerpc,kurt2008-06-251-2/+23
| | | | | sparc64. The rest will come later. okay drahn@ no objection miod@ "Get it in" deraadt@
* remove "unused variable" warningschl2007-10-171-2/+1
| | | | | | tested by deraadt@ on a gcc2 arch looks ok ray@ ok deraadt@
* zap rcsid. Okay deraadt@, krw@espie2005-08-041-5/+1
|
* things for amd64; from art@mickey2004-01-283-0/+250