[Bug 235751] Failure to init TLS variables with func ptr inside shared lib

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 19 Jan 2025 16:20:13 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235751

--- Comment #8 from Dennis Clarke <dclarke@blastwave.org> ---
(In reply to Konstantin Belousov from comment #7)

What precisely did you do?

I see no way that you made this work just fine on a 14.0-STABLE system
when it fails in the same way on 13.4-RELEASE-p1 machine : 

$ uname -apKU 
FreeBSD dasoyva 13.4-RELEASE-p1 FreeBSD 13.4-RELEASE-p1 GENERIC amd64 amd64
1304000 1304000
$ freebsd-version -kru 
13.4-RELEASE-p1
13.4-RELEASE-p1
13.4-RELEASE-p2
$ 
$ which cc
/usr/bin/cc
$ CC=/usr/bin/cc
$ export CC
$ 
$ $CC --version
FreeBSD clang version 18.1.6 (https://github.com/llvm/llvm-project.git
llvmorg-18.1.6-0-g1118c2e05e67)
Target: x86_64-unknown-freebsd13.4
Thread model: posix
InstalledDir: /usr/bin
$

$ $CC -std=iso9899:1999 -pedantic -pedantic-errors -m64 -g -O0 -fno-builtin
-shared -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=600
-D_REENTRANT -o t1.so -fPIC t1.c

$ $CC -std=iso9899:1999 -pedantic -pedantic-errors -m64 -g -O0 -fno-builtin
-shared -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=600
-D_REENTRANT -o foo t2.c t1.so

$ file foo
foo: ELF 64-bit LSB shared object, x86-64, version 1 (FreeBSD), dynamically
linked, for FreeBSD 13.4, with debug_info, not stripped

$ readelf -delV foo | grep -E 'NEED|NAME|PATH'
 0x0000000000000001 NEEDED               Shared library: [t1.so]
 0x0000000000000001 NEEDED               Shared library: [libc.so.7]
 0x000000006ffffffe VERNEED              0x340
 0x000000006fffffff VERNEEDNUM           1

$ ./foo
Segmentation fault (core dumped)

$ LD_LIBRARY_PATH=`pwd` ./foo
Segmentation fault (core dumped)
$ 

So you are saying that, with magic, the problem goes away on a 14 STABLE 
machine and then returns everywhere else?

-- 
You are receiving this mail because:
You are the assignee for the bug.