From fb63a60d6e15d022dee453363dbaf647cbc2a507 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 25 Aug 2026 15:31:53 +0300 Subject: [PATCH] rtld i386: use macro for the 'GNU ABI' calling convention of TLS resolver Discussed with: jrtc27 Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59269 --- libexec/rtld-elf/i386/reloc.c | 3 +-- libexec/rtld-elf/i386/rtld_machdep.h | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c index 845735deac7d..060b3cb147e3 100644 --- a/libexec/rtld-elf/i386/reloc.c +++ b/libexec/rtld-elf/i386/reloc.c @@ -519,8 +519,7 @@ allocate_initial_tls(Obj_Entry *objs) _tcb_set(tls); } -/* GNU ABI */ -__attribute__((__regparm__(1))) void * +__GNU_ABI void * ___tls_get_addr(tls_index *ti) { return (tls_get_addr_common(_tcb_get(), ti->ti_module, ti->ti_offset)); diff --git a/libexec/rtld-elf/i386/rtld_machdep.h b/libexec/rtld-elf/i386/rtld_machdep.h index 7eb7b1cdfb77..574eafe432db 100644 --- a/libexec/rtld-elf/i386/rtld_machdep.h +++ b/libexec/rtld-elf/i386/rtld_machdep.h @@ -78,7 +78,9 @@ typedef struct { unsigned long ti_offset; } tls_index; -void *___tls_get_addr(tls_index *ti) __attribute__((__regparm__(1))) __exported; +#define __GNU_ABI __attribute__((__regparm__(1))) + +void *___tls_get_addr(tls_index *ti) __GNU_ABI __exported; void *__tls_get_addr(tls_index *ti) __exported; #define md_abi_variant_hook(x) @@ -86,4 +88,5 @@ void *__tls_get_addr(tls_index *ti) __exported; size_t calculate_first_tls_offset(size_t size, size_t align, size_t offset); size_t calculate_tls_offset(size_t prev_offset, size_t prev_size, size_t size, size_t align, size_t offset); + #endif