Date: Sun, 26 Jan 2025 12:16:53 -0800 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: freebsd-hackers@freebsd.org Subject: gcc14 static linking ends with segfault Message-ID: <Z5aYNdVQdGdVImBG@troutmask.apl.washington.edu>
next in thread | raw e-mail | index | archive | help
In replacing an ancient system with new I re-installed all ports including lang/gcc14 of FreeBSD-current. -current is 2 day old sources. Consider, #include <stdio.h> #include <stdlib.h> #include "mpfr.h" int main(void) { mpfr_t pi; mpfr_inits2(512, pi, NULL); mpfr_const_pi(pi, MPFR_RNDN); mpfr_printf("pi = %25.20Rf\n", pi); // A conscientious programmer cleans up after themself, // but on exit the system should take care of memory. // mpfr_clears(pi, NULL); return (0); } % gcc14 -o z -O2 -I/usr/local/include a.c -L/usr/local/lib -lmpfr -lgmp % ./z pi = 3.14159265358979323846 All seems to work with shared linking. The following used to work. % gcc14 -o z -O2 -I/usr/local/include a.c -L/usr/local/lib -lmpfr -lgmp \ -static % ./z pi = 3.14159265358979323846 Segmentation fault (core dumped) % gdb151 ./z z.core ... #0 0x0000000000427ba5 in __gmpn_mul_1 () (gdb) bt #0 0x0000000000427ba5 in __gmpn_mul_1 () #1 0x000000000040051f in __do_global_dtors_aux () at /usr/src/lib/csu/common/crtbegin.c:83 #2 0x00000000004bc165 in _fini () #3 0x0000000000458a7f in __cxa_finalize (dso=dso@entry=0x0) at /usr/src/lib/libc/stdlib/atexit.c:234 #4 0x0000000000458b70 in exit (status=0) at /usr/src/lib/libc/stdlib/exit.c:89 #5 0x00000000004483d9 in __libc_start1 (argc=1, argv=0x820a52900, env=0x820a52910, cleanup=<optimized out>, mainX=0x400480 <main>) at /usr/src/lib/libc/csu/libc_start1.c:172 #6 0x00000000004004f0 in _start () at /usr/src/lib/csu/amd64/crt1_s.S:83 So, did someone break the startup files? -- Steve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Z5aYNdVQdGdVImBG>