For strange reasons which made sense at the time, the text segment wasplaced head of the btext (boot.text) segment. (the boot.text segment is"unmapped" after initization, as a self-protection mech
For strange reasons which made sense at the time, the text segment wasplaced head of the btext (boot.text) segment. (the boot.text segment is"unmapped" after initization, as a self-protection mechanism). this meantthe LOAD's virtual addresses were not in sequence, which clearly isn'twhat we intended.
show more ...
Make sure the syscall table entries are aligned on a 4-byte boundary.Required for strict-alignment architectures and a good idea on others.same as kettenis commit to libc
Populate the non-LOAD openbsd.syscalls section (and PT_OPENBSD_SYSCALL)with {uint offset, uint syscall#} entries in libc & ld.so.In libc a few syscall# entries (break, sigprocmask, _tfork, _threxit
Populate the non-LOAD openbsd.syscalls section (and PT_OPENBSD_SYSCALL)with {uint offset, uint syscall#} entries in libc & ld.so.In libc a few syscall# entries (break, sigprocmask, _tfork, _threxit)are duplicated because additional or inline uses occur (that situationis handled elsewhere)ok kettenis
crt0 uses a helper function in a MD src/libexec/ld.so .h file (rather thanreproducing the relevant defines and code in a different place) to performminor relocations. If things go very wrong, it w
crt0 uses a helper function in a MD src/libexec/ld.so .h file (rather thanreproducing the relevant defines and code in a different place) to performminor relocations. If things go very wrong, it would call _dl_exit() --a locally defined crt0 function which is syscall exit(2). We don't needto call exit(2) for this obscure case which doesn't happen and provides nodebugging information. An 'abort' is going to provide better information.So let's change the function name to _dso_abort() and make it a singleillegal instruction.ok guenther
unify spacing for LOAD FLAGS lines
Unite all nitems copies in ld.so/util.hOK deraadt
riscv64 ld.so is ready to be xonlyok kettenis
Since the introduction of automatic immutable from the kernel, the munmap()of ld.so boot.text region is now (silently) failing because the region iscontained within the text LOAD, which is immutabl
Since the introduction of automatic immutable from the kernel, the munmap()of ld.so boot.text region is now (silently) failing because the region iscontained within the text LOAD, which is immutable. So create a new btextLOAD with flags PF_X|PF_R|PF_OPENBSD_MUTABLE, and place all boot.text objectsin there. This LOAD must also be page-aligned so it doesn't skip unmappingsome of the object region, previously it was hilariously unaligned.ok kettenis and guenther seemed to like it alsoThis one is for riscv64, tested by jca
Nothing depends on archdep.h pulling in other #includes anymore,so delete the #includes and hide the RELOC_* functions that areonly used by lib/csu behind "#ifdef RCRT0"ok jca@
Prep .c files for removing the #includes from */archdep.h * replace #include "archdep.h" with #includes of what is used, pulling in "syscall.h", "util.h", and "archdep.h" as needed * delete #inc
Prep .c files for removing the #includes from */archdep.h * replace #include "archdep.h" with #includes of what is used, pulling in "syscall.h", "util.h", and "archdep.h" as needed * delete #include <sys/syscall.h> from syscall.h * only pull in <sys/stat.h> to the three files that use _dl_fstat(), forward declare struct stat in syscall.h for the others * NBBY is for <sys/select.h> macros; just use '8' in dl_printf.c * <machine/vmparam.h> is only needed on i386; conditionalize it * stop using __LDPGSZ: use _MAX_PAGE_SHIFT (already used by malloc.c) where necessary * delete other bogus #includes, order legit per style: <sys/*> then <*/*>, then <*>, then "*"dir.c improvement from jsg@ok and testing assistance deraadt@
Roll the syscalls that have an off_t argument to remove the explicit padding.Switch libc and ld.so to the generic stubs for these calls.WARNING: reboot to updated kernel before installing libc or l
Roll the syscalls that have an off_t argument to remove the explicit padding.Switch libc and ld.so to the generic stubs for these calls.WARNING: reboot to updated kernel before installing libc or ld.so!Time for a story...When gcc (back in 1.x days) first implemented long long, it didn't (always)pass 64bit arguments in 'aligned' registers/stack slots, with the result thatargument offsets didn't match structure offsets. This affected the nine systemcalls that pass off_t arguments: ftruncate lseek mmap mquery pread preadv pwrite pwritev truncateTo avoid having to do custom ASM wrappers for those, BSD put an explicit padargument in so that the off_t argument would always start on a even slot andthus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use__syscall() and pass an extra '0' argument.The ABIs for different CPUs eventually settled how things should be passed oneach and gcc 2.x followed them. The only arch now where it helps is landisk,which needs to skip the last argument register if it would be the first half ofa 64bit argument. So: add new syscalls without the pad argument and on landiskdo that skipping directly in the syscall handler in the kernel. Keep compatsupport for the existing syscalls long enough for the transition.ok deraadt@
Delete all the no-op RELOC_GOT() macros and their uses.Annotate RELOC_DYN() on non-hppa as only used in lib/csu.Delete some inconsistent comments, adjust whitespace, and reorder mips64's archdep.
Delete all the no-op RELOC_GOT() macros and their uses.Annotate RELOC_DYN() on non-hppa as only used in lib/csu.Delete some inconsistent comments, adjust whitespace, and reorder mips64's archdep.h so that the ld.so/*/archdep.h files look (almost) the same.ok visa@ kettenis@
Like most archs, riscv doesn't need resolution of JUMP_SLOT relocationsin static PIE binaries: delete RELOC_JMPREL and HAVE_JMPREL there.ok kettenis@
Make lazy binding work on riscv64.prompted by deraadt@
Build ld.so with --march=rv64imac on riscv64 to be absolutely sure thatld.so doesn't use the FP registers.ok deraadt@
Correct problem in riscv64 dtors execution load the function pointercorrectly and do not overwrite it in csu.allows most ld.so regressions to passconfirmed by jsg@, ok kettenis
riscv64 ld.soderived from arm64go ahead deraadt@