summaryrefslogtreecommitdiffstats
path: root/lib/csu (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Need to compile rcrt0.o with -fno-jump-tables on powerpc as well.kettenis2019-07-011-3/+8
| | | | ok visa@
* Since clang only supports the "secure" PLT ABI for "big" PIC/PIE on powerpc,kettenis2019-06-281-9/+1
| | | | | | stop building the csu code with -fpie on that platform. ok guenther@, visa@
* ld.so boot cleanup support:guenther2019-05-103-6/+18
| | | | | | | | | | | | | | | | | - 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@
* Work around a limitation of clang integrated assembler on mips64.visa2019-04-191-1/+4
| | | | | | | | | The assembler does not handle undeclared local symbols properly and generates R_MIPS_CALL16 relocations where it should generate local GOT references. For now, get along with the problem by declaring local symbols where necessary. OK kettenis@ guenther@
* Prevent clang from using builtins and jump tables in _dl_boot_bind()visa2019-04-191-1/+6
| | | | | | | on mips64. They need relocation and consequently cannot be used in that function. OK kettenis@
* Separate symbol name and type with a comma for consistency andvisa2019-03-231-2/+2
| | | | | | to make clang happier. No binary change with gas.
* Remove -S from install commandskn2019-02-241-2/+2
| | | | | | | | As of usr.bin/xinstall/install.c revision 1.68, -S is a no-op and install(1) will always create files safely, thus clean the option usage from the tree. Diff from Lauri Tirkkonen <lotheac at iki dot fi>, thanks.
* Use static consistently with definitions of functions that have beenvisa2019-01-093-8/+8
| | | | | | declared static. OK guenther@
* Add support for {preinit,init,fini}_array sections in static binariesguenther2018-12-213-2/+34
| | | | ok kettenis@
* Make alpha less special: _dl_boot_bind() is written to completeguenther2018-11-222-41/+7
| | | | | | | | | relocation of ld.so's GOT without using it, so _reloc_alpha_got() merely made the call to _dl_boot_bind() from asm simpler...while itself being a call that required special handling. diff and muild baking by miod@ ok guenther@
* Insert definitions of environ and __progname in MD_CRT0_START again.aoyama2018-10-061-1/+5
| | | | | | | | | | That part is not needed with a PIE toolchain, but until gcc 4 on m88k receives enough fixes to produce as good code as gcc 3, the bits in r1.5 are still required. This fixes miniperl does not work correctly while building perl on m88k. Diff is suggested by Miod Vallat, tested by him and me, ok guenther@
* Fix address calculation for _DYNAMIC. We want to address of _DYNAMIC itself,kettenis2018-07-241-2/+2
| | | | | | | | | not the address of its GOT entry. The current code mixed the high bits of the GOT entry address with the low bits of the true address. This only worked by accident for small binaries where _DYNAMIC and its GOT entry happen to reside on the same page. ok guenther@, mortimer@
* Add add PIE support for m88k (requires gcc4 toolchain)guenther2018-06-161-5/+37
| | | | | | Convert __cerror to hidden visibility. from miod@
* Fix dependency generation: pass ${DFLAGS} and -MF explicitlyguenther2017-08-121-8/+11
| | | | | problem noted by deraadt@ ok espie@
* _dl_printf is no longer referenced by RELOC_{JMPREL,DYN,GOT}; delete the stubguenther2017-08-119-61/+9
| | | | ok kettenis@
* remove misc. depend and yacc nits that no longer matter.espie2017-07-101-4/+1
| | | | okay millert@
* Our certbegin/certend is always PIC, so remove the non-PIC MD_SECT_CALL_FUNC()kettenis2017-02-262-30/+2
| | | | | | implementations. ok guenther@
* Use a long branch (using movw/movt) to implement MD_SECT_CALL_FUNC.kettenis2017-02-261-15/+5
| | | | | | Necessary (but perhaps not suffcient) to build large binaries on arm. ok guenther@
* Move static variables from .data to .bss by not initializing them to zeroguenther2017-02-192-6/+6
| | | | ok kettenis@
* remove unused variableschl2017-01-291-3/+1
| | | | ok krw@ guenther@
* Fix passing &_DYNAMIC to _dl_boot_bind; makes -static -pie work.kettenis2017-01-241-2/+3
|
* Make crtbegin.c and crtbeginS.c consistent on stylistic pointsguenther2017-01-212-20/+16
| | | | ok kettenis@
* Pull in declarations for main() and __init() to make clang happy.guenther2017-01-212-6/+4
| | | | | | Mark __init() as hidden ok kettenis@ deraadt@
* Fix misspelling in commentguenther2017-01-211-2/+2
|
* amd64 can build rcrt0.o with the stack-protectorguenther2017-01-211-3/+10
| | | | ok kettenis@ deraadt@
* Declare the symbols that label the .ctors, .dtors, .eh_frame, and .jcrguenther2017-01-217-39/+95
| | | | | | | | | | sections as extern hidden arrays of indefinite size, so that the compiler (well, clang) doesn't believe it knows the exact contents and thus optimize things into infinite loops. Actually set the symbols to be in the sections and insert the leading and trailing values via __asm(). Problem pointed out by patrick@ testing and ok kettenis@
* MD_START is now always ___start, so expand and eliminate itguenther2017-01-193-11/+4
| | | | ok phessler@ deraadt@
* Add support for AArch64.patrick2017-01-111-0/+130
|
* Remove the (now unused) code to determine the page size. Also get rid ofkettenis2017-01-021-10/+1
| | | | | | the extern declaration of __got_{start,end}. ok guenther@
* Replace return by break; requested by guenther@kettenis2016-12-241-2/+2
|
* Remove code that reprotects the GOT based on the __got_start and __got_endkettenis2016-12-241-11/+1
| | | | | | | | | symbols. Either the PT_LOAD RWX->RX case ot PT_GNU_RELRO should cover this already for anything we care about. And lld, the llvm linker, doesn't emit the __got_start and __got_end symbols and there are good reasons to leave it that way. ok guenther@
* Don't make __CTOR_LIST__ and __DTOR_LIST__ const. This makes the .ctors andkettenis2016-12-221-3/+3
| | | | | | | | .dtors sections writable just like they are in crtend.o and code generated by compilers. This is necessary to make sure that linkers that respect the ELF spec a bit better (such as lld) correctly concatenate the secttions. ok deraadt@
* A couple more unused variables.krw2016-12-191-3/+2
| | | | tweak & ok kettenis@
* Use sed -i to post-process .depend. This avoids permission issues causednatano2016-11-081-8/+2
| | | | | | by the file being created in /tmp. tweaks and ok tb
* unify tmp depend generation.espie2016-10-151-5/+8
| | | | | | | | - simpler uniform pattern - put the tmpfile in OBJDIR, so that mv doesn't whine about groups when using a separate builduser. okay millert@
* 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@