summaryrefslogtreecommitdiffstats
path: root/lib/csu (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Simplify code that sets up a stack frame for running .init code to be morekettenis2016-10-031-5/+3
| | | | | | AEABI-like. ok tom@, jsg@
* Now that vax has been removed, nothing defined MD_NO_CLEANUP anymore.kettenis2016-09-261-5/+1
| | | | ok guenther@
* Implement self-relocation for -static -pie on arm. Also removes somekettenis2016-09-081-9/+54
| | | | | | | unecessary code from the normal startup code and do some general cleanup to make the code more readable. ok guenther@, jsg@
* Enable PIE on arm now that sjlj exceptions are no longer used afterjsg2016-09-031-6/+1
| | | | | | | | | | the switch to eabi. This does not include static PIE which will be handled later. A specific sequence of steps is required to cross over this change, using a snapshot is the easiest way to do so. ok kettenis@
* retire sparctedu2016-09-013-143/+4
|
* Look for a PT_GNU_RELRO section and, if present, mprotect that rangeguenther2016-08-081-8/+24
| | | | | | | | | | instead of the [__got_start, __got_end) range. Also, instead of mprotecting the [__plt_start, __plt_end) range, just scan for sections which are both writable and executable and mprotect them to read-only. (This part was stolen from kettenis@) ok kettenis@
* Teach mips64 to pass &_DYNAMIC to _dl_boot_bind().guenther2016-08-072-7/+4
| | | | mips64be testing by deraadt@
* alpha already calculates &_DYNAMIC for the _reloc_alpha_got() call, soguenther2016-08-072-6/+5
| | | | save that and pass it to _dl_boot_bind() too
* Teach i386 to pass &_DYNAMIC to _dl_boot_bind()guenther2016-08-072-4/+5
|
* Psych: amd64 has been passing &_DYNAMIC to _dl_boot_bind() for 19 monthsguenther2016-08-071-2/+2
|
* Flip the #ifdef logic: amd64, i386, and mips64 were the only static PIEguenther2016-08-071-5/+4
| | | | archs using the #else case
* Missed a reference to dl_prebind.hguenther2016-07-051-2/+1
| | | | problem noted by Andrew Ngo (andrew.ngo (at) gmail.com)
* remove hppa64 port, which we never got going beyond broken single users.deraadt2016-05-111-98/+0
| | | | | | hppa reverse-stack gives us a valuable test case, but most developers don't have a 2nd one to proceed further with this. ok kettenis
* 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@
* Unbreak arm and m88k: COPY relocations for weak symbols that are overloadedguenther2016-03-242-2/+11
| | | | | | | with strong symbols in ld.so don't do what we need, so put definitions back in crt0 and make ld.so update __progname like it does environ. report and testing patrick@ jsg@
* Rearrange C runtime bits: now that ld.so exports environ and __progname,guenther2016-03-2013-159/+19
| | | | | | | | | | | 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@
* crt0.c is already setting environ, so don't set it in MD_START_SETUPguenther2016-03-135-10/+10
| | | | ok kettenis@ mpi@
* Call mprotect() via its hidden _lib_mprotect alias to avoid accidentalguenther2016-03-121-1/+8
| | | | | | overriding ok deraadt@ kettenis@
* We are done providing support for the vax.deraadt2016-03-091-75/+0
| | | | lots of agreement.
* Simplify the relocation code for the ld.so bootstrap and static pie: trackguenther2015-12-061-132/+71
| | | | | | | | just the dynamic tags are needed instead of reusing the generic elf_object_t structure. testing and feedback from miod@ ok kettenis@
* libc.so can't be unloaded, so move the hidden atexit() and pthread_atfork()guenther2015-11-101-22/+1
| | | | | | | | | | | stubs for the executable from crtbegin.o into libc, which lets them be excluded from static links that don't use them. For this, drop the normal crt{begin,end}S.o from libc.so: the .init and .fini sections for libc aren't called at the right times anyway, so it's good that they're unused. libc.so just needs __guard_local and the .note.openbsd.ident section, so add them to stack_protector.c for now (this will be improved) "good time" deraadt@
* We don't need to calculate the load offset. This also means we don't needkettenis2015-09-191-8/+1
| | | | | | to calculate the GOT address anymore. ok guenther@ (who spotted the latter bit)
* Make sure we set PROT_EXEC on the GOT for BSS-PLT binaries on powerpc.kettenis2015-09-191-2/+10
| | | | ok guenther@
* Fetch the _GLOBAL)OFFSET_TABLE_ and _DYNAMIC pointers in a way that'skettenis2015-09-091-43/+9
| | | | compatible with the Secure-PLT ABI.
* Now that ld(1) will generate a read-only GOT for truly static binaries, wekettenis2015-09-091-72/+4
| | | | | | | no longer have to use mprotect(2) to take away PROT_WRITE. This fixes ld -Z and paves the way for the new Secure-PLT ABI. ok miod@
* In static binaries, invoke kbind() once to disable it.guenther2015-09-0114-17/+122
| | | | | With much assistance from miod@ ok deraadt@@
* Do not include os-note-elf.h here, otherwise we end up with duplicate OS noteskettenis2015-08-171-3/+1
| | | | | | in our binaries. ok miod@
* static pie support for sparc.miod2015-07-032-4/+63
|
* Make pthread_atfork() track the DSO that called it like atexit() does,guenther2015-04-072-2/+29
| | | | | | | | | | unregistering callbacks if the DSO is unloaded. Move the callback handling from libpthread to libc, though libpthread still overrides the inner call to handle locking and thread-library reinitialization. Major version bump for both libc and libpthread. verification that this fixes various ports ajacoutot@ asm assistance miod@; ok millert@ deraadt@
* gcc 2.x is deadguenther2015-04-044-25/+8
| | | | ok millert@
* argc is passed as a long by the kernel, define it as such to match whatmiod2015-02-071-2/+2
| | | | other ports do.
* <sys/param.h> is not needed here either.deraadt2015-01-161-2/+1
| | | | ok guenther millert doug
* Inline the .cpsetup pseudo-statement in rcrt0 to avoid saving the "old" gpmiod2015-01-011-2/+4
| | | | value, which we have no use for. ok kettenis@
* self-relocating crt0 bits for sh, and enable static pie by default. With somemiod2014-12-301-6/+67
| | | | archdep.h help from kettenis@
* Make the PLT read-only on powerpc as well.kettenis2014-12-291-2/+2
| | | | ok kurt@
* Static PIE for mips64. Still something not quite right as a full make buildkettenis2014-12-271-1/+44
| | | | | | fails. ok kurt@
* Only include "boot.h" if MD_RCRT0_START is defined. Should fix build on vax.kettenis2014-12-271-1/+3
| | | | ok miod@
* Static PIE support for alpha.kettenis2014-12-272-8/+80
| | | | | | | | | | | | | 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@
* Self-relocation code for powerpc.kurt2014-12-261-1/+99
|
* Use archdep.h GOT_PERMS define for mprotect of GOT. okay kettenis@kurt2014-12-251-2/+2
|
* Expand Elf_Rel relocations to include DT_JMPREL. Inspect DT_PLTREL valuekurt2014-12-241-6/+21
| | | | | | | | 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@
* Fix previos. Pointed out by kurt@.kettenis2014-12-241-2/+2
|
* Use the page size passed by the kernel in the Auxilliary Vector to handlekettenis2014-12-231-5/+11
| | | | architectures with variable page size.
* Make sure the GOT and PLT are not writable.kettenis2014-12-231-1/+23
| | | | | | | | | | 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@
* do not expose "ra" to cpp because it muddles up the .c code above.deraadt2014-12-231-7/+5
| | | | | instead handle it internally as $ra solution from kettenis, ok guenther
* Set up the linkage table register (%r19) before calling _dl_boot_bind.kettenis2014-12-231-9/+9
|
* Self-relocation code for i386.kurt2014-12-221-1/+50
|
* Self-relocation code for hppa.kettenis2014-12-221-1/+73
|
* Self-relocation code for sparc64.kettenis2014-12-221-1/+44
|
* When skipping a relocation because the referenced symbol is undefined, makekettenis2014-12-221-5/+7
| | | | | | sure we move on to the next relocation entry. While there, also skip relocations for REL architectures.