Fix initial exec TLS mode for dynamically loaded shared objects.If dso uses initial exec TLS mode, rtld tries to allocate TLS instatic space. If there is no space left, the dlopen(3) fails. If spa
Fix initial exec TLS mode for dynamically loaded shared objects.If dso uses initial exec TLS mode, rtld tries to allocate TLS instatic space. If there is no space left, the dlopen(3) fails. If spaceif allocated, initial content from PT_TLS segment is distributed toall threads' pcbs, which was missed and caused un-initialized TLSsegment for such dso after dlopen(3).The mode is auto-detected either due to the relocation used, or if theDF_STATIC_TLS dynamic flag is set. In the later case, the TLS segmentis tried to allocate earlier, which increases chance of the dlopen(3)to succeed. LLD was recently fixed to properly emit the flag, ld.bdfdid it always.Initial test by: dumbbellTested by: emaste (amd64), ian (arm)Tested by: Gerald Aryeetey <aryeeteygerald_rogers.com> (arm64)Sponsored by: The FreeBSD FoundationMFC after: 2 weeksDifferential revision: https://reviews.freebsd.org/D19072
show more ...
lib: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using mis-identified many licenses so this was mostly a manual - errorpr
lib: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using mis-identified 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.
libthr: fix warnings at WARNS=6Fix more warnings about redundant declarations.Reviewed by: kib emasteMFC after: 3 daysSponsored by: Dell EMCDifferential Revision: https://reviews.freebsd.org/D
libthr: fix warnings at WARNS=6Fix more warnings about redundant declarations.Reviewed by: kib emasteMFC after: 3 daysSponsored by: Dell EMCDifferential Revision: https://reviews.freebsd.org/D10932
[mips] convert over =v to =r for the inline assembly.Later gcc and clang have deprecated =v (which maps to a specific tempregister) and instead we should just use =r to have the assembler(hopeful
[mips] convert over =v to =r for the inline assembly.Later gcc and clang have deprecated =v (which maps to a specific tempregister) and instead we should just use =r to have the assembler(hopefully!) save/restore things appropriately after choosinga register.Tested:* AR9344 SoC, with userreg support* AR9331 SoC, with no userreg supportSponsored by: Sponsored by: DARPA, AFRL (MIPS TLS user register work)
[mips] add support for using the MIPS user register for TLS data.This work, originally from Stacey Son, uses the MIPS UserReg forreading the TLS data, and will fall back to the normal syscall path
[mips] add support for using the MIPS user register for TLS data.This work, originally from Stacey Son, uses the MIPS UserReg forreading the TLS data, and will fall back to the normal syscall pathwhen it isn't supported.This code dynamically patches cpu_switch() to bypass the UserReginstruction so to avoid generating a machine exception.Thanks to sson for the original work, and to Dan Nelson forbringing it to date and testing it on MIPS32 with me.Tested:* mips64 (sson)* mips74k ([email protected]) - AR9344 SoC, UserReg support* mips24k (adrian) - AR9331 SoC, no UserReg supportObtained from: sson, [email protected]
Merge all the copies of _tcb_ctor and _tcb_dtor.The amd64, i386, and sparc64 versions were identical, with the onedifference where the former two used inline asm instead of _tcb_get. Ihave compar
Merge all the copies of _tcb_ctor and _tcb_dtor.The amd64, i386, and sparc64 versions were identical, with the onedifference where the former two used inline asm instead of _tcb_get. Ihave compared the function before and after replacing the asm with _tcb_getand found the object files to be identical.The arm, mips, and powerpc versions were almost identical. The onlydifference was the powerpc version used an alignment of 1 where arm andmips used 16. As this is an increase in alignment is will be safe.Along with this arm, mips, and powerpc all passed, when initial was true,the value returned from _tcb_get as the first argument to_rtld_allocate_tls. This would then return this pointer back to the caller.We can remove these extra calls by checking if initial is set and settingthe thread control block directly. As this is what the sparc64 code doeswe can use it directly.As after these observations all the architectures can now have identicalcode we can merge them into a common file.Differential Revision: https://reviews.freebsd.org/D1556Reviewed by: kibSponsored by: The FreeBSD Foundation
- Switch to saving non-offseted pointer to TLS block in order too keep things simple
Switch MIPS TLS implementation to Variant I:Save pointer to the TLS structure taking into account TP_OFFSETand TCB structure size.
Merge r195129 from project/mips to head by hand:r195129 | gonzo | 2009-06-27 17:28:56 -0600 (Sat, 27 Jun 2009) | 2 lines- Use sysarch(2) in MIPS version of _tcb_set/_tcb_get
Commit missing mips libthr support that I thought I'd committed earlier