[Bug 235751] Failure to init TLS variables with func ptr inside shared lib
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 20 Jan 2025 17:52:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235751 Dennis Clarke <dclarke@blastwave.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|New |Closed Resolution|--- |Not A Bug --- Comment #11 from Dennis Clarke <dclarke@blastwave.org> --- This is entirely PEBKAC given that the second command issued to LLVM/Clang also specified -shared and that is wrong. titan$ uname -apKU FreeBSD titan 15.0-CURRENT FreeBSD 15.0-CURRENT #5 main-n274856-488660360a71: Sat Jan 18 17:03:26 GMT 2025 root@titan:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64 amd64 1500030 1500030 titan$ echo $CC /usr/bin/cc titan$ $CC --version FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2) Target: x86_64-unknown-freebsd15.0 Thread model: posix InstalledDir: /usr/bin Build config: +assertions titan$ $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 * * * careful here to NOT use -shared * * * titan$ $CC -std=iso9899:1999 -pedantic -pedantic-errors -m64 -g -O0 -fno-builtin -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=600 -D_REENTRANT -o foo t2.c t1.so titan$ LD_LIBRARY_PATH=`pwd` ./foo titan$ echo $? 42 titan$ Well lo and behold. So this is a user error in that the -shared should NOT be there on the compile and link line : titan$ $CC -std=iso9899:1999 -pedantic -pedantic-errors -m64 -g -O0 -fno-builtin -shared -D_LARGEFILE64_SOUR CE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=600 -D_REENTRANT -o foo t2.c t1.so titan$ file foo foo: ELF 64-bit LSB shared object, x86-64, version 1 (FreeBSD), dynamically linked, for FreeBSD 15.0 (1500030), with debug_info, not stripped titan$ LD_LIBRARY_PATH=`pwd` ./foo Segmentation fault (core dumped) titan$ Closing this as a dumb user error. -- You are receiving this mail because: You are the assignee for the bug.