Re: gcc14 static linking ends with segfault
- In reply to: Steve Kargl : "Re: gcc14 static linking ends with segfault"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 27 Jan 2025 19:15:46 UTC
On 27 Jan 2025, at 19:42, Steve Kargl <sgk@troutmask.apl.washington.edu> wrote: > > On Mon, Jan 27, 2025 at 04:34:22PM +0100, Dimitry Andric wrote: ... >> Summarizing, I think that it is weird that gcc doesn't use its own >> crtbegin object, at least for static linking. There may be some >> historical reason for it, but it should then also not use its own crtend >> object! > ... > Not sure about a historical reason, but gcc14 seems to not > supply crt1.o, crt1.o, crtbeginT.o, ot crtn.o. Thus, the > linker is picking up those files from /usr/lib. > > % find /usr/local/lib/gcc14/ -name crt\*.o > /usr/local/lib/gcc14/gcc/x86_64-portbld-freebsd15.0/14.2.0/crtbegin.o > /usr/local/lib/gcc14/gcc/x86_64-portbld-freebsd15.0/14.2.0/crtend.o > /usr/local/lib/gcc14/gcc/x86_64-portbld-freebsd15.0/14.2.0/crtbeginS.o > /usr/local/lib/gcc14/gcc/x86_64-portbld-freebsd15.0/14.2.0/crtendS.o > > If I move gcc14/.../crtend.o out of the way, then the segfault goes away Yes, that's one way to do it. Another way is to change the spec file, or a patch like this, which I'm now trying out: --- libgcc/config.host.orig 2024-08-01 08:17:17 UTC +++ libgcc/config.host @@ -286,7 +286,7 @@ case ${host} in # machine-specific sections may refine and add to this # configuration. tmake_file="$tmake_file t-freebsd t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver" - extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" + extra_parts="crtbegin.o crtend.o crtbeginS.o crtbeginT.o crtendS.o" case ${target_thread_file} in posix) tmake_file="${tmake_file} t-freebsd-thread" Though I'm not sure if the resulting crtbeginT.o will work as expected. -Dimitry