History log of /freebsd/libexec/rtld-elf/amd64/reloc.c (Results 1 – 25 of 98)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 3a85aa6a 18-Jan-2025 Konstantin Belousov <kib@FreeBSD.org>

rtld-elf/amd64/reloc.c: apply clang-format

Discussed with: emaste, imp
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D48509


# e3035c52 18-Jan-2025 Konstantin Belousov <kib@FreeBSD.org>

rtld-elf/{amd64,i386}/reloc.c: remove unneeded #ifdef dbg

Discussed with: emaste, imp
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D48509


Revision tags: release/14.2.0, release/13.4.0
# 33658afd 22-Aug-2024 Jessica Clarke <jrtc27@FreeBSD.org>

rtld-elf: Pass parsed aux_info to ifunc_init

Currently we pass the raw pointer to the on-stack auxargs. This can
legitimately have fewer than AT_COUNT entries, so the use of
__min_size(AT_COUNT), i.

rtld-elf: Pass parsed aux_info to ifunc_init

Currently we pass the raw pointer to the on-stack auxargs. This can
legitimately have fewer than AT_COUNT entries, so the use of
__min_size(AT_COUNT), i.e. static AT_COUNT, is inaccurate, and also
needlessly forces the callee to iterate over the elements to find the
entry for a given type. Instead we can just pass aux_info like we use
for everything else.

Note that the argument has been left unused by every callee since its
introduction in 4352999e0e6c ("Pass CPUID[1] %edx (cpu_feature), %ecx
(cpu_feature2) and CPUID[7].%ebx (cpu_stdext_feature), %ecx
(cpu_stdext_feature2) to the ifunc resolvers on x86.")

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D46276

show more ...


Revision tags: release/14.1.0, release/13.3.0, release/14.0.0
# 95335dd3 29-Oct-2023 Stephen J. Kiernan <stevek@FreeBSD.org>

rtld: introduce STATIC_TLS_EXTRA

The new STATIC_TLS_EXTRA variable provides a means for applications
to increases the size of the extra static TLS space allocated by
rtld beyond the default of '128'

rtld: introduce STATIC_TLS_EXTRA

The new STATIC_TLS_EXTRA variable provides a means for applications
to increases the size of the extra static TLS space allocated by
rtld beyond the default of '128'. This extra static TLS space is used
for objects loaded with dlopen.

The value specified in the variable must be no less than the default
value and no greater than the maximum allowed value for size_t type.

If an invalid value is specified, rtld will ignore it and just use
the default value.

The rtld(1) man page is updated to document this new option.

Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D42025

show more ...


# b3e76948 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 283a4f40 05-Jun-2023 Konstantin Belousov <kib@FreeBSD.org>

rtld: rename tls_done to tls_static

The meaning of the flag is that static TLS allocation was done.

Taken from NetBSD Joerg Sonnenberger change for src/libexec/ld.elf_so/tls.c
rev. 1.18.

Sponsored

rtld: rename tls_done to tls_static

The meaning of the flag is that static TLS allocation was done.

Taken from NetBSD Joerg Sonnenberger change for src/libexec/ld.elf_so/tls.c
rev. 1.18.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

show more ...


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

show more ...


Revision tags: release/13.2.0
# 5942b4b6 14-Feb-2023 Konstantin Belousov <kib@FreeBSD.org>

sys/param.h: Add _WANT_P_OSREL

Use it instead of defining IN_RTLD by base sources that want P_OSREL_
defines in userspace, but are not rtld.
This allows to remove abuse of IN_RTLD from userspace.

R

sys/param.h: Add _WANT_P_OSREL

Use it instead of defining IN_RTLD by base sources that want P_OSREL_
defines in userspace, but are not rtld.
This allows to remove abuse of IN_RTLD from userspace.

Reviewed by: dchagin, markj, imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D38585

show more ...


Revision tags: release/12.4.0, release/13.1.0
# 8bcdb144 09-Dec-2021 John Baldwin <jhb@FreeBSD.org>

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

show more ...


# 29961749 09-Dec-2021 John Baldwin <jhb@FreeBSD.org>

amd64: Allocate TCB with alignment of 16 rather than 8.

This matches the TLS_TCB_ALIGN definition in libc.

Reviewed by: kib, jrtc27
Sponsored by: The University of Cambridge, Google Inc.
Differenti

amd64: Allocate TCB with alignment of 16 rather than 8.

This matches the TLS_TCB_ALIGN definition in libc.

Reviewed by: kib, jrtc27
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33349

show more ...


Revision tags: release/12.3.0
# 8f63fa78 14-Aug-2021 Fangrui Song <i@maskray.me>

rtld: Remove calculate_tls_end

Variant I architectures use off and Variant II ones use size + off.
Define TLS_VARIANT_I/TLS_VARIANT_II symbols similarly to how libc
handles it.

Reviewed by: kib
MFC

rtld: Remove calculate_tls_end

Variant I architectures use off and Variant II ones use size + off.
Define TLS_VARIANT_I/TLS_VARIANT_II symbols similarly to how libc
handles it.

Reviewed by: kib
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31539
Differential revision: https://reviews.freebsd.org/D31541

show more ...


# e6c76962 14-Aug-2021 Fangrui Song <i@maskray.me>

rtld: Fix i386/amd64 TP offset when p_vaddr % p_align != 0

For a Variant II architecture, the TP offset of a TLS symbol is st_value -
tlsoffset + r_addend. tlsoffset is computed by either calculate_

rtld: Fix i386/amd64 TP offset when p_vaddr % p_align != 0

For a Variant II architecture, the TP offset of a TLS symbol is st_value -
tlsoffset + r_addend. tlsoffset is computed by either calculate_tls_offset
or calculate_first_tls_offset.

The return value of calculate_first_tls_offset is the smallest integer
satisfying res >= size and (-res) % p_align = p_vaddr % p_align
(= p_offset % p_align). (The formula is a bit contrived. The basic idea
is to subtract the minimum integer from size + align - 1 so that the result
ihas the expected remainder.)

Reviewed by: kib
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31538
Differential revision: https://reviews.freebsd.org/D31541

show more ...


Revision tags: release/13.0.0
# e8b9c508 07-Apr-2021 Konstantin Belousov <kib@FreeBSD.org>

rtld: use _get_tp() in __tls_get_addr()

This eliminates some non-trivial amount of code duplication, where done.
Only x86 and mips are handled right now.

Tested by: bdragon (powerpc), mhorne (

rtld: use _get_tp() in __tls_get_addr()

This eliminates some non-trivial amount of code duplication, where done.
Only x86 and mips are handled right now.

Tested by: bdragon (powerpc), mhorne (riscv)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623

show more ...


# f61ecf60 07-Apr-2021 Konstantin Belousov <kib@FreeBSD.org>

rtld/x86/reloc.c: style

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29623


# b58c853e 24-Dec-2020 Marius Strobl <marius@FreeBSD.org>

rtld-elf(1): remove obsolete pre_init() hook

It's no longer used since 600ee699ed2805894f5972c6ac2c3d17dca7f6ce
and r358358 respectively.


Revision tags: release/12.2.0, release/11.4.0
# e5c3405c 19-Apr-2020 Konstantin Belousov <kib@FreeBSD.org>

Align initial-exec TLS segments to the p_vaddr % align.

This is continuation of D21163/r359634, which handled the alignment
for 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 alignment
for global mode.

Non-x86 arches are not handled, maintainers are welcomed.

Tested by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D24366

show more ...


# 74dc6beb 14-Feb-2020 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r357855 through r357920.


# c5ca0d11 14-Feb-2020 Konstantin Belousov <kib@FreeBSD.org>

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: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23652

show more ...


Revision tags: release/12.1.0, release/11.3.0
# 4849c3a5 15-Dec-2018 Michal Meloun <mmel@FreeBSD.org>

Improve R_AARCH64_TLSDESC relocation.
The original code did not support dynamically loaded libraries and used
suboptimal 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 used
suboptimal access to TLS variables.
New implementation removes lazy resolving of TLS relocation - due to flaw
in TLSDESC design is impossible to switch resolver function at runtime
without 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, 232311
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18417

show more ...


Revision tags: release/12.0.0
# 3d5db455 24-Nov-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r340427 through r340868.


# bac111cc 23-Nov-2018 Konstantin Belousov <kib@FreeBSD.org>

Silence gcc warnings.

Reported by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 3 days


# 2a22df74 04-Nov-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r339813 through r340125.


# ca2b9726 30-Oct-2018 Konstantin Belousov <kib@FreeBSD.org>

Remove rtld use of libc amd64_set_fsbase().

One less non-trivial dependency of rtld on libc. Also,
amd64_set_fsbase() is to be converted to ifunc, which I do not want to
support inside rtld.

Spons

Remove rtld use of libc amd64_set_fsbase().

One less non-trivial dependency of rtld on libc. Also,
amd64_set_fsbase() is to be converted to ifunc, which I do not want to
support inside rtld.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

show more ...


# 903e0ffd 29-Oct-2018 Alex Richardson <arichardson@FreeBSD.org>

rtld-elf: compile with WANRS=4 warnings other than -Wcast-align

Reviewed By: kib
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17153


Revision tags: release/11.2.0
# 41fc6f68 04-Feb-2018 Marius Strobl <marius@FreeBSD.org>

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().

show more ...


1234