https://gcc.gnu.org/g:df09e09c0bad09421984e4f52344baf5d81a3570

commit r17-984-gdf09e09c0bad09421984e4f52344baf5d81a3570
Author: Rainer Orth <[email protected]>
Date:   Fri May 29 16:24:40 2026 +0200

    libgcc: Support -mcall-ms2sysv-xlogues on FreeBSD/x86
    
    With the bulk of the gcc.target/x86_64/abi tests fixed on FreeBSD/amd64,
    a couple remain:
    
    FAIL: gcc.target/x86_64/abi/ms-sysv/ms-sysv.c -mcall-ms2sysv-xlogues -O2 
"-DGEN_ARGS=-p0\ --omit-rbp-clobbers" (test for excess errors)
    
    and five more.  They all fail to link like
    
    gld-2.46: /tmp//ccXprYoX.o: in function `msabi_00_0':
    ms-sysv.c:(.text+0x30): undefined reference to `__sse_savms64f_12'
    
    and many more missing symbols.  Those are usually provided in libgcc.a
    by i386/t-msabi, so this patch includes them on FreeBSD/x86, too.  As
    with the previous fixes, the resms64*.h and savms64*.h files need to
    include .note.GNU-stack, too.
    
    Bootstrapped without regressions on amd64-pc-freebsd15.0 with both gld
    and /usr/bin/ld (lld), and x86_64-pc-linux-gnu.
    
    2026-03-19  Rainer Orth  <[email protected]>
    
            libgcc:
            * config.host <i[34567]86-*-freebsd*> (tmake_file): Add
            i386/t-msabi.
            <x86_64-*-freebsd*>: Likewise.
            * config/i386/i386-asm.h: Update comment.
    
            * config/i386/resms64.h: Use .note.GNU-stack on FreeBSD, too.
            * config/i386/resms64f.h: Likewise.
            * config/i386/resms64fx.h: Likewise.
            * config/i386/resms64x.h: Likewise.
            * config/i386/savms64.h: Likewise.
            * config/i386/savms64f.h: Likewise.

Diff:
---
 libgcc/config.host             | 4 ++--
 libgcc/config/i386/i386-asm.h  | 2 +-
 libgcc/config/i386/resms64.h   | 2 +-
 libgcc/config/i386/resms64f.h  | 2 +-
 libgcc/config/i386/resms64fx.h | 2 +-
 libgcc/config/i386/resms64x.h  | 2 +-
 libgcc/config/i386/savms64.h   | 2 +-
 libgcc/config/i386/savms64f.h  | 2 +-
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libgcc/config.host b/libgcc/config.host
index cb4c512ada3b..046156fa5e78 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -766,11 +766,11 @@ x86_64-*-dragonfly*)
        md_unwind_header=i386/dragonfly-unwind.h
        ;;
 i[34567]86-*-freebsd*)
-       tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff"
+       tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff i386/t-msabi"
        md_unwind_header=i386/freebsd-unwind.h
        ;;
 x86_64-*-freebsd*)
-       tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff"
+       tmake_file="${tmake_file} i386/t-freebsd i386/t-crtstuff i386/t-msabi"
        md_unwind_header=i386/freebsd-unwind.h
        ;;
 i[34567]86-*-netbsdelf*)
diff --git a/libgcc/config/i386/i386-asm.h b/libgcc/config/i386/i386-asm.h
index e761cba64ab6..091547dd6476 100644
--- a/libgcc/config/i386/i386-asm.h
+++ b/libgcc/config/i386/i386-asm.h
@@ -58,7 +58,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If 
not, see
 #define PASTE2(a, b) PASTE2a(a, b)
 #define PASTE2a(a, b) a ## b
 
-/* These macros currently support GNU/Linux, Solaris and Darwin.  */
+/* These macros currently support GNU/Linux, Solaris, FreeBSD, and Darwin.  */
 
 #ifdef __ELF__
 # define FN_TYPE(fn) .type fn,@function
diff --git a/libgcc/config/i386/resms64.h b/libgcc/config/i386/resms64.h
index 380c2c7193ba..8785fafb7d95 100644
--- a/libgcc/config/i386/resms64.h
+++ b/libgcc/config/i386/resms64.h
@@ -58,7 +58,7 @@ MS2SYSV_STUB_END(resms64_18)
 
 #endif /* __x86_64__ */
 
-#if defined(__ELF__) && defined(__linux__)
+#if defined(__ELF__) && (defined(__linux__) || defined(__FreeBSD__))
        .section .note.GNU-stack,"",@progbits
        .previous
 #endif
diff --git a/libgcc/config/i386/resms64f.h b/libgcc/config/i386/resms64f.h
index d098b0f91e0e..b78c3cd09473 100644
--- a/libgcc/config/i386/resms64f.h
+++ b/libgcc/config/i386/resms64f.h
@@ -56,7 +56,7 @@ MS2SYSV_STUB_END(resms64f_17)
 
 #endif /* __x86_64__ */
 
-#if defined(__ELF__) && defined(__linux__)
+#if defined(__ELF__) && (defined(__linux__) || defined(__FreeBSD__))
        .section .note.GNU-stack,"",@progbits
        .previous
 #endif
diff --git a/libgcc/config/i386/resms64fx.h b/libgcc/config/i386/resms64fx.h
index 698de382c895..45817b19af55 100644
--- a/libgcc/config/i386/resms64fx.h
+++ b/libgcc/config/i386/resms64fx.h
@@ -63,7 +63,7 @@ MS2SYSV_STUB_END(resms64fx_17)
 
 #endif /* __x86_64__ */
 
-#if defined(__ELF__) && defined(__linux__)
+#if defined(__ELF__) && (defined(__linux__) || defined(__FreeBSD__))
        .section .note.GNU-stack,"",@progbits
        .previous
 #endif
diff --git a/libgcc/config/i386/resms64x.h b/libgcc/config/i386/resms64x.h
index 39e42c8e0aab..23dc3a5ee43a 100644
--- a/libgcc/config/i386/resms64x.h
+++ b/libgcc/config/i386/resms64x.h
@@ -64,7 +64,7 @@ MS2SYSV_STUB_END(resms64x_18)
 
 #endif /* __x86_64__ */
 
-#if defined(__ELF__) && defined(__linux__)
+#if defined(__ELF__) && (defined(__linux__) || defined(__FreeBSD__))
        .section .note.GNU-stack,"",@progbits
        .previous
 #endif
diff --git a/libgcc/config/i386/savms64.h b/libgcc/config/i386/savms64.h
index 8ae8f12606ac..2331f06f1321 100644
--- a/libgcc/config/i386/savms64.h
+++ b/libgcc/config/i386/savms64.h
@@ -58,7 +58,7 @@ MS2SYSV_STUB_END(savms64_18)
 
 #endif /* __x86_64__ */
 
-#if defined(__ELF__) && defined(__linux__)
+#if defined(__ELF__) && (defined(__linux__) || defined(__FreeBSD__))
        .section .note.GNU-stack,"",@progbits
        .previous
 #endif
diff --git a/libgcc/config/i386/savms64f.h b/libgcc/config/i386/savms64f.h
index 9bdd3c9944eb..0a9ec8e0827c 100644
--- a/libgcc/config/i386/savms64f.h
+++ b/libgcc/config/i386/savms64f.h
@@ -56,7 +56,7 @@ MS2SYSV_STUB_END(savms64f_17)
 
 #endif /* __x86_64__ */
 
-#if defined(__ELF__) && defined(__linux__)
+#if defined(__ELF__) && (defined(__linux__) || defined(__FreeBSD__))
        .section .note.GNU-stack,"",@progbits
        .previous
 #endif

Reply via email to