rtld: Remove calculate_tls_end(cherry picked from commit 8f63fa78e84afd23fa68c82eabfe64763c92d4f5)
rtld-elf(1): remove obsolete pre_init() hookIt's no longer used since 600ee699ed2805894f5972c6ac2c3d17dca7f6ceand r358358 respectively.
Add CFI start/end proc directives to arm64, i386, and ppcFollow-up to r353959 and r368070: do the same for other architectures.arm32 already seems to use its own .fnstart/.fnend directives, which
Add CFI start/end proc directives to arm64, i386, and ppcFollow-up to r353959 and r368070: do the same for other architectures.arm32 already seems to use its own .fnstart/.fnend directives, whichappear to be ARM-specific variants of the same thing. Likewise, MIPSuses .frame directives.Reviewed by: arichardsonDifferential Revision: https://reviews.freebsd.org/D27387
show more ...
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
rtld: clean up Makefile.Move all MD statements into $MACHINE_ARCH/Makefile.inc.Unconditionally apply version script to rtld, the interpreter is notfunctional without it for long time.Reviewed b
rtld: clean up Makefile.Move all MD statements into $MACHINE_ARCH/Makefile.inc.Unconditionally apply version script to rtld, the interpreter is notfunctional without it for long time.Reviewed by: brooks, emasteSponsored by: The FreeBSD FoundationDifferential revision: https://reviews.freebsd.org/D23083
[PowerPC] powerpc64 rtld IFUNC handling codeAs PowerPC is moving to clang, we can finally start taking advantage ofIFUNC.Implement the MD parts of IFUNC handling for rtld.Currently, it is nece
[PowerPC] powerpc64 rtld IFUNC handling codeAs PowerPC is moving to clang, we can finally start taking advantage ofIFUNC.Implement the MD parts of IFUNC handling for rtld.Currently, it is necessary to look for R_PPC_IRELATIVE in the PLT inaddition to RELA. This is an ABI violation, but LLD9 has some .iplt bugsthat require this as a workaround.Reviewed by: kibDifferential Revision: https://reviews.freebsd.org/D22789
[PPC64] Fix rtld direct exec modeInstead of restoring the saved values of argc, argv and envp,these must be loaded from the stack that _rtld() modifies.This fixes rtld direct exec mode.E.g.: /l
[PPC64] Fix rtld direct exec modeInstead of restoring the saved values of argc, argv and envp,these must be loaded from the stack that _rtld() modifies.This fixes rtld direct exec mode.E.g.: /libexec/ld-elf.so.1 /bin/lsReviewed by: jhibbitsDifferential Revision: https://reviews.freebsd.org/D21131
Fix rtld-elf compilation warning for powerpc64 ELFv2 ABISummary: reloc_jmpslot function parameter 'defobj' is not used when using ELFv2ABISubmitted by: alfredo.junior_eldorado.org.brReviewed By
Fix rtld-elf compilation warning for powerpc64 ELFv2 ABISummary: reloc_jmpslot function parameter 'defobj' is not used when using ELFv2ABISubmitted by: alfredo.junior_eldorado.org.brReviewed By: kib, git_bdragon.rtk0.net, emaste, jhibbitsDifferential Revision: https://reviews.freebsd.org/D18808
rtld-elf: Fix powerpc64 TLS handling, matching powerpc's fixWe need to subtract the TLS_TCB_SIZE to get to the real data pointer, sincer13 points to the end of the TCB structure. Prior to this, d
rtld-elf: Fix powerpc64 TLS handling, matching powerpc's fixWe need to subtract the TLS_TCB_SIZE to get to the real data pointer, sincer13 points to the end of the TCB structure. Prior to this, devel/protobuf-cport broke with recent update to devel/protobuf, which exposed this issue.Submitted by: andreastReported by: Piotr KubajMFC after: 1 week
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
Flush data cache for executable loadable segments explicitly.Do not use textsize and do not flush everything between map base andbase + textsize, because unmapped areas cannot be flushed.This ma
Flush data cache for executable loadable segments explicitly.Do not use textsize and do not flush everything between map base andbase + textsize, because unmapped areas cannot be flushed.This makes Obj_Entry textsize only use go away, and I will remove itlater.Reported by: tuexenTested by: Mark Millard <[email protected]>Sponsored by: The FreeBSD Foundation
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
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().
libexec: adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - errorprone -
libexec: adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - errorprone - task.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier for automated tools to detect and summarize well knownopensource licenses. We are gradually adopting the specification, notingthat the tags are considered only advisory and do not, in any way,superceed or replace the license texts.No functional change intended.
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
Adjust r308689 to make rtld compilable with either in-tree or(hopefully) stock gcc 4.2.1 on i386 and other arches.In particular:- Do not use %ebx in the asm constraints on i386, since rtld is c
Adjust r308689 to make rtld compilable with either in-tree or(hopefully) stock gcc 4.2.1 on i386 and other arches.In particular:- Do not use %ebx in the asm constraints on i386, since rtld is compiled with -fPIC and gcc cannot handle GOT-base register reload (clang and newer gcc can).- Avoid direct use of [static N] construct in the function declaration/definion. In-tree gcc was patched to support this, but stock 4.2.1 cannot handle the feature.Requested by: bdeSponsored by: The FreeBSD FoundationMFC after: 1 week
Pass CPUID[1] %edx (cpu_feature), %ecx (cpu_feature2) andCPUID[7].%ebx (cpu_stdext_feature), %ecx (cpu_stdext_feature2) to theifunc resolvers on x86.It is much more clean to use CPUID instruction
Pass CPUID[1] %edx (cpu_feature), %ecx (cpu_feature2) andCPUID[7].%ebx (cpu_stdext_feature), %ecx (cpu_stdext_feature2) to theifunc resolvers on x86.It is much more clean to use CPUID instruction in usermode to retrievethis information than to pass AT_HWCAP aux vector from kernel, onx86. Still, the change does allow for use of AT_HWCAP on arches where it isneeded, by passing aux array to ifunc_init() initializer which shouldprepare arguments for ifunc resolvers.Current signature for resolvers on x86 is func_t iresolve(uint32_t cpu_feature, uint32_t cpu_feature2, uint32_t cpu_stdext_feature, uint32_t cpu_stdext_feature2);where arguments have identical meaning as the kernel variables of thesame name. The ABIs allow to use resolvers with the void or shortenedlist of arguments.Reviewed by: jhbSponsored by: The FreeBSD FoundationMFC after: 1 weekDifferential revision: https://reviews.freebsd.org/D8448
rtld-elf: use NULL instead of zero for pointers.
Do not call callbacks for dl_iterate_phdr(3) with the rtld bind andphdr locks locked. This allows to call rtld services from thecallback, which is only reasonable for dlopen(path, RTLD_NOLOAD) to
Do not call callbacks for dl_iterate_phdr(3) with the rtld bind andphdr locks locked. This allows to call rtld services from thecallback, which is only reasonable for dlopen(path, RTLD_NOLOAD) totest existence of the library in the image, and for dlsym(). Thelater might still be not quite safe, due to the lazy resolution offilters.To allow dropping the locks around iteration in dl_iterate_phdr(3), weinsert markers to track current position between relocks. The globalobjects list is converted to tailq and all iterators skip markers,globallist_next() and globallist_curr() helpers are added.Reported and tested by: davideReviewed by: kanSponsored by: The FreeBSD FoundationMFC after: 3 weeks
Create a generalized exec hook that different architectures can hookinto if they need to, but default to no action.Differential Review: https://reviews.freebsd.org/D2718
12