rtld: Add MD_OBJ_ENTRY to extend Struct_Obj_EntryAdd a macro the architectures can use to add per-arch fields toStruct_Obj_Entry.Reviewed by: kibSponsored by: Arm LtdDifferential Revision: htt
rtld: Add MD_OBJ_ENTRY to extend Struct_Obj_EntryAdd a macro the architectures can use to add per-arch fields toStruct_Obj_Entry.Reviewed by: kibSponsored by: Arm LtdDifferential Revision: https://reviews.freebsd.org/D45116(cherry picked from commit 06db20ffeca9898e5802d63f3b06caaa37c3a4ed)
show more ...
rtld: introduce STATIC_TLS_EXTRA(cherry picked from commit 95335dd3c19e0ade161bb4dc8462fc3d045ce4f8)
Remove $FreeBSD$: one-line .c patternRemove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
Remove $FreeBSD$: two-line .h patternRemove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
rtld: rename tls_done to tls_staticThe meaning of the flag is that static TLS allocation was done.Taken from NetBSD Joerg Sonnenberger change for src/libexec/ld.elf_so/tls.crev. 1.18.Sponsored
rtld: rename tls_done to tls_staticThe meaning of the flag is that static TLS allocation was done.Taken from NetBSD Joerg Sonnenberger change for src/libexec/ld.elf_so/tls.crev. 1.18.Sponsored by: The FreeBSD FoundationMFC after: 1 week
rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call"After the removal of ia64 and sparc64, all current architecturessupport executable stacks at an architectural level.This rever
rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call"After the removal of ia64 and sparc64, all current architecturessupport executable stacks at an architectural level.This reverts commit 1290d38ac50b3afa7e5781d9d97346a1042c736c.Reviewed by: kibSponsored by: DARPADifferential Revision: https://reviews.freebsd.org/D37904
TLS: Use <machine/tls.h> for libc and rtld.- Include <machine/tls.h> in MD rtld_machdep.h headers.- Remove local definitions of TLS_* constants from rtld_machdep.h headers and libc using the va
TLS: Use <machine/tls.h> for libc and rtld.- Include <machine/tls.h> in MD rtld_machdep.h headers.- Remove local definitions of TLS_* constants from rtld_machdep.h headers and libc using the values from <machine/tls.h> instead.- Use _tcb_set() instead of inlined versions in MD allocate_initial_tls() routines in rtld. The one exception is amd64 whose _tcb_set() invokes the amd64_set_fsbase ifunc. rtld cannot use ifuncs, so amd64 inlines the logic to optionally write to fsbase directly.- Use _tcb_set() instead of _set_tp() in libc.- Use '&_tcb_get()->tcb_dtv' instead of _get_tp() in both rtld and libc. This permits removing _get_tp.c from rtld.- Use TLS_TCB_SIZE and TLS_TCB_ALIGN with allocate_tls() in MD allocate_initial_tls() routines in rtld.Reviewed by: kib, jrtc27 (earlier version)Differential Revision: https://reviews.freebsd.org/D33353
rtld-elf: Use _get_tp in __tls_get_addr for aarch64 and riscv64.Reviewed by: kibSponsored by: The University of Cambridge, Google Inc.Differential Revision: https://reviews.freebsd.org/D33047
rtld: Remove calculate_tls_endVariant I architectures use off and Variant II ones use size + off.Define TLS_VARIANT_I/TLS_VARIANT_II symbols similarly to how libchandles it.Reviewed by: kibMFC
rtld: Remove calculate_tls_endVariant I architectures use off and Variant II ones use size + off.Define TLS_VARIANT_I/TLS_VARIANT_II symbols similarly to how libchandles it.Reviewed by: kibMFC after: 1 weekDifferential revision: https://reviews.freebsd.org/D31539Differential revision: https://reviews.freebsd.org/D31541
rtld-elf(1): remove obsolete pre_init() hookIt's no longer used since 600ee699ed2805894f5972c6ac2c3d17dca7f6ceand r358358 respectively.
Maintain a stack alignment of 16-bytes.This violated the RISC-V 64-bit ABI. On CheriBSD this manifested asa trap when attempting to store 16-byte aligned types while zeroingthe stack.Reported
Maintain a stack alignment of 16-bytes.This violated the RISC-V 64-bit ABI. On CheriBSD this manifested asa trap when attempting to store 16-byte aligned types while zeroingthe stack.Reported by: CHERI, jrtc27Reviewed by: mhorne, brObtained from: CheriBSDSponsored by: DARPADifferential Revision: https://reviews.freebsd.org/D26327
Align initial-exec TLS segments to the p_vaddr % align.This is continuation of D21163/r359634, which handled the alignmentfor global mode.Non-x86 arches are not handled, maintainers are welcomed
Align initial-exec TLS segments to the p_vaddr % align.This is continuation of D21163/r359634, which handled the alignmentfor global mode.Non-x86 arches are not handled, maintainers are welcomed.Tested by: emasteSponsored by: The FreeBSD FoundationMFC after: 2 weeksDifferential revision: https://reviews.freebsd.org/D24366
Handle non-plt IRELATIVE relocations, at least for x86.lld 10.0 seems to generate this relocation for rdtsc_mb() ifunc in our libc.Reported, reviewed, and tested by: dim (amd64, previous version)
Handle non-plt IRELATIVE relocations, at least for x86.lld 10.0 seems to generate this relocation for rdtsc_mb() ifunc in our libc.Reported, reviewed, and tested by: dim (amd64, previous version)Discussed with: emasteSponsored by: The FreeBSD FoundationMFC after: 1 weekDifferential revision: https://reviews.freebsd.org/D23652
Correct the offset of static TLS variables for Initial-Exec on RISC-V.TP points to the start of the TLS block after the tcb, butObj_Entry.tlsoffset includes the tcb, so subtract the size of the tc
Correct the offset of static TLS variables for Initial-Exec on RISC-V.TP points to the start of the TLS block after the tcb, butObj_Entry.tlsoffset includes the tcb, so subtract the size of the tcbto compute the offset relative to TP.This is identical to the same fixes for powerpc in r339072 and r342671.Reviewed by: James ClarkeSponsored by: DARPADifferential Revision: https://reviews.freebsd.org/D22661
Improve R_AARCH64_TLSDESC relocation.The original code did not support dynamically loaded libraries and usedsuboptimal access to TLS variables.New implementation removes lazy resolving of TLS relo
Improve R_AARCH64_TLSDESC relocation.The original code did not support dynamically loaded libraries and usedsuboptimal access to TLS variables.New implementation removes lazy resolving of TLS relocation - due to flawin TLSDESC design is impossible to switch resolver function at runtimewithout expensive locking.Due to this, 3 specialized resolvers are implemented: - load time resolver for TLS relocation from libraries loaded with main executable (thus with known TLS offset). - resolver for undefined thread weak symbols. - slower lazy resolver for dynamically loaded libraries with fast path for already resolved symbols.PR: 228892, 232149, 233204, 232311MFC after: 2 weeksDifferential Revision: https://reviews.freebsd.org/D18417
rtld-elf: fix more warnings to allow compiling with WARNS=6Reviewed By: kibApproved By: brooks (mentor)Differential Revision: https://reviews.freebsd.org/D17154
rtld-elf: compile with WANRS=4 warnings other than -Wcast-alignReviewed By: kibApproved By: brooks (mentor)Differential Revision: https://reviews.freebsd.org/D17153
Rework rtld's TLS Variant I implementation to match r326794The above commit fixed handling overaligned TLS segments in libc'sTLS Variant I implementation, but rtld provides its own implementation
Rework rtld's TLS Variant I implementation to match r326794The above commit fixed handling overaligned TLS segments in libc'sTLS Variant I implementation, but rtld provides its own implementationfor dynamically-linked executables which lacks these fixes. Thus,port these changes to rtld.This was previously commited as r337978 and reverted in r338149 due toexposing a bug the ARM rtld. This bug was fixed in r338317 by mmel.Submitted by: James ClarkeApproved by: re (kib)Reviewed by: kbowlingTesting by: kbowling (powerpc64), br (riscv), kevans (armv7)Obtained from: CheriBSDSponsored by: DARPA, AFRLDifferential Revision: https://reviews.freebsd.org/D16510
Revert r337978: Rework rtld's TLS Variant I implementation to match r326794Michal Meloun reports that it breaks ctype (isspace()..) relatedfunctions on armv7 so back out while we diagnose the issu
Revert r337978: Rework rtld's TLS Variant I implementation to match r326794Michal Meloun reports that it breaks ctype (isspace()..) relatedfunctions on armv7 so back out while we diagnose the issue.Reported by: Michal Meloun <[email protected]>
Rework rtld's TLS Variant I implementation to match r326794The above commit fixed handling overaligned TLS segments in libc'sTLS Variant I implementation, but rtld provides its own implementationfor dynamically-linked executables which lacks these fixes. Thus,port these changes to rtld.Submitted by: James ClarkeReviewed by: kbowlingTesting byL kbowling (powerpc64), br (riscv), kevans (armv7)Obtained from: CheriBSDSponsored by: DARPA, AFRLDifferential Revision: https://reviews.freebsd.org/D16510
Save and restore floating-point arguments.Sponsored by: DARPA, AFRL
o Let rtld(1) set up psABI user trap handlers prior to executing the objects' init functions instead of doing the setup via a constructor in libc as the init functions may already depend on these
o Let rtld(1) set up psABI user trap handlers prior to executing the objects' init functions instead of doing the setup via a constructor in libc as the init functions may already depend on these handlers to be in place. This gets us rid of: - the undefined order in which libc constructors as __guard_setup() and jemalloc_constructor() are executed WRT __sparc_utrap_setup(), - the requirement to link libc last so __sparc_utrap_setup() gets called prior to constructors in other libraries (see r122883). For static binaries, crt1.o still sets up the user trap handlers.o Move misplaced prototypes for MD functions in to the MD prototype section of rtld.h.o Sprinkle nitems().
Support for v1.10 (latest) of RISC-V privilege specification.New version is not compatible on supervisor mode with v1.9.1(previous version).Highlights: o BBL (Berkeley Boot Loader) provides
Support for v1.10 (latest) of RISC-V privilege specification.New version is not compatible on supervisor mode with v1.9.1(previous version).Highlights: o BBL (Berkeley Boot Loader) provides no initial page tables anymore allowing us to choose VM, to build page tables manually and enable MMU in S-mode. o SBI interface changed. o GENERIC kernel. FDT is now chosen standard for RISC-V hardware description. DTB is now provided by Spike (golden model simulator). This allows us to introduce GENERIC kernel. However, description for console and timer devices is not provided in DTB, so move these devices temporary to nexus bus. o Supervisor can't access userspace by default. Solution is to set SUM (permit Supervisor User Memory access) bit in sstatus register. o Compressed extension is now turned on by default. o External GCC 7.1 compiler used. o _gp renamed to __global_pointer$ o Compiler -march= string is now in use allowing us to choose required extensions (compressed, FPU, atomic, etc).Sponsored by: DARPA, AFRLDifferential Revision: https://reviews.freebsd.org/D11800
rtld: fix warnings about redundant declarationsFix warnings about redundant declarations in rtldwhen libthr in increased to WARNS=6.Reviewed by: kibMFC after: 3 daysSponsored by: Dell EMCDiff
rtld: fix warnings about redundant declarationsFix warnings about redundant declarations in rtldwhen libthr in increased to WARNS=6.Reviewed by: kibMFC after: 3 daysSponsored by: Dell EMCDifferential Revision: https://reviews.freebsd.org/D10934
Implement LD_BIND_NOT knob for rtld.From the manpage:When set to a nonempty string, prevents modifications of the PLT slotswhen doing bindings. As result, each call of the PLT-resolvedfunction
Implement LD_BIND_NOT knob for rtld.From the manpage:When set to a nonempty string, prevents modifications of the PLT slotswhen doing bindings. As result, each call of the PLT-resolvedfunction is resolved. In combination with debug output, this providescomplete account of all bind actions at runtime.Same feature exists on Linux and Solaris.Sponsored by: The FreeBSD FoundationMFC after: 2 weeks
12