https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235751
Bug ID: 235751
Summary: Failure to init TLS variables with func ptr inside
shared lib
Product: Base System
Version: 12.0-RELEASE
Hardware: powerpc
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: kern
Assignee: [email protected]
Reporter: [email protected]
This is the exact same problem as described in Bug 161344.
Re-discovered this because libmpfr 4.0.2 fails most of its
tests unless one disables thread local storage.
hydra$ uname -a
FreeBSD hydra 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC powerpc
hydra$ echo $CC
/usr/local/bin/gcc8
hydra$ echo $CFLAGS
-g -m64 -std=c99 -fno-builtin -O0 -mcpu=970 -mcall-freebsd -mno-altivec
-mno-float128 -mno-float128-hardware -mfull-toc -mregnames
-fno-unsafe-math-optimizations
hydra$ cat -n t1.c
1
2 int f(int x) {
3 return x;
4 }
5 struct s_t {
6 int (*func)(int);
7 };
8 struct s_t __thread x = { f };
9
10
hydra$
hydra$ cat -n t2.c
1
2
3 struct s_t {
4 int (*func)(int);
5 };
6 extern struct s_t __thread x;
7 int main(int argc, const char *argv[]) {
8 return (*x.func)(argc);
9 }
10
hydra$
hydra$ $CC $CFLAGS -shared -o t1.so -fPIC t1.c
hydra$ $CC $CFLAGS -o foo t2.c t1.so
hydra$ LD_LIBRARY_PATH=. ./foo
Segmentation fault (core dumped)
hydra$
hydra$ gdb foo foo.core
GNU gdb (GDB) 8.2.1 [GDB v8.2.1 for FreeBSD]
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "powerpc64-portbld-freebsd12.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from foo...done.
[New LWP 100253]
Core was generated by `./foo'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000010000a1c in main (argc=1, argv=0x3fffffffffffd7f0) at t2.c:8
8 return (*x.func)(argc);
(gdb) where
#0 0x0000000010000a1c in main (argc=1, argv=0x3fffffffffffd7f0) at t2.c:8
(gdb) list
3 struct s_t {
4 int (*func)(int);
5 };
6 extern struct s_t __thread x;
7 int main(int argc, const char *argv[]) {
8 return (*x.func)(argc);
9 }
10
(gdb) quit
However the problem goes away entirely with r344130.
Also tested the situation with mpfr 4.0.2 and TLS seems to work with r344130.
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"