[PATCH] config.host: add crtbeginT.o to extra_parts for FreeBSD [PR118685]
Gerald Pfeifer
gerald@pfeifer.com
Sat Feb 8 16:39:55 GMT 2025
On Tue, 28 Jan 2025, Dimitry Andric wrote:
> Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118685
>
> This ensures that gcc uses its own crt objects for static linking.
> Otherwise, it could mix the base system's crtbeginT.o with libgcc's
> crtend.o, leading to possible segfaults.
>
> Signed-off-by: Dimitry Andric <dimitry@andric.com>
Thank you, Dim!
I ran a regression test and pushed this to trunk adding a ChangeLog entry
and adjusting the commit message a bit as follows. I plan to push back to
the gcc-14 branch shortly and the gcc-13 and gcc-12 branches gradually.
Gerald
commit 06e5b0b4a244090abfea333d91fc5963292cb41d
Author: Dimitry Andric <dimitry@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 <dimitry@andric.com>
diff --git a/libgcc/config.host b/libgcc/config.host
index 8930081069e..6a88ee5a2dd 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -292,7 +292,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"
More information about the Gcc-patches
mailing list