https://gcc.gnu.org/g:23541b23deb5504c6d3c0a3e96a0858e10c3c627
commit r12-10960-g23541b23deb5504c6d3c0a3e96a0858e10c3c627 Author: Dimitry Andric <dimi...@andric.com> Date: Tue Jan 28 18:36:16 2025 +0100 libgcc: On FreeBSD use GCC's crt objects for static linking Add crtbeginT.o to extra_parts on FreeBSD. This ensures we use GCC's crt objects for static linking. Otherwise it could mix crtbeginT.o from the base system with libgcc's crtend.o, possibly leading to segfaults. libgcc: PR target/118685 * config.host (*-*-freebsd*): Add crtbeginT.o to extra_parts. Signed-off-by: Dimitry Andric <dimi...@andric.com> Diff: --- libgcc/config.host | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgcc/config.host b/libgcc/config.host index 89e3dbc7c8a7..8aa22123addb 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -271,7 +271,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"