https://gcc.gnu.org/g:6984448d0d785c63736fa78fad0146fbd4c86c62

commit r17-1906-g6984448d0d785c63736fa78fad0146fbd4c86c62
Author: Iain Sandoe <[email protected]>
Date:   Fri Jun 26 11:41:38 2026 +0100

    testsuite, c, Darwin: Fix Mach-O issues in toplevel asm tests.
    
    Current Darwin no longer supports non-pie executables, leading to spurious
    fails because of linker warnings; skip these cases.
    
    Several of the tests also needed updates for Mach-O ABI (e.g asm directive
    spellings or USER_LABEL_PREFIX).  This fixes the UNRESOLVED cases but not
    the actual fail of toplevel-simple-asm-2.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.dg/lto/toplevel-extended-asm-1_0.c: Skip for Darwin.
            * gcc.dg/lto/toplevel-extended-asm-2_0.c: Fix Mach-O syntax.
            * gcc.dg/lto/toplevel-extended-asm-2_1.c: Likewise.
            * gcc.dg/lto/toplevel-simple-asm-1_0.c: Skip for Darwin.
            * gcc.dg/lto/toplevel-simple-asm-2_1.c: Fix Mach-O syntax.
    
    Signed-off-by: Iain Sandoe <[email protected]>

Diff:
---
 gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-1_0.c | 1 +
 gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-2_0.c | 8 ++++++++
 gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-2_1.c | 8 ++++++++
 gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-1_0.c   | 1 +
 gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-2_1.c   | 9 +++++++++
 5 files changed, 27 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-1_0.c 
b/gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-1_0.c
index 6082fbe11662..c4e9d536bdb5 100644
--- a/gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-1_0.c
+++ b/gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-1_0.c
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options {{-O2 -flto -flto-partition=1to1 -no-pie} } } */
 /* { dg-skip-if "SPARC relocation overflow" { sparc*-*-solaris2* && lp64 } } */
+/* { dg-skip-if "no-pie unsupported" { *-*-darwin* } "" "" } */
 
 void asm_fn();
 void asm_fn_used();
diff --git a/gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-2_0.c 
b/gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-2_0.c
index 089ce2e04609..f3690d5675f5 100644
--- a/gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-2_0.c
+++ b/gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-2_0.c
@@ -6,7 +6,15 @@ extern int use_statics ();
 extern int asm_var;
 
 static int a;
+#if __APPLE__
+#if __LP64__
+asm ("%cc0: .quad 0" :: ":"(&a));
+#else
+asm ("%cc0: .long 0" :: ":"(&a));
+#endif
+#else
 asm (".local %cc0\n %cc0: .long 0" :: ":"(&a));
+#endif
 
 int main() {
   return a + use_statics ();
diff --git a/gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-2_1.c 
b/gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-2_1.c
index f0a6ec3fdf5a..9d70ad5a5da7 100644
--- a/gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-2_1.c
+++ b/gcc/testsuite/gcc.dg/lto/toplevel-extended-asm-2_1.c
@@ -7,7 +7,15 @@ extern int asm_var;
 asm("%cc0:" :: ":" (&asm_var));
 
 static int a;
+#if __APPLE__
+#if __LP64__
+asm ("%cc0: .quad 0" :: ":"(&a));
+#else
+asm ("%cc0: .long 0" :: ":"(&a));
+#endif
+#else
 asm (".local %cc0\n %cc0: .long 0" :: ":"(&a));
+#endif
 
 int use_statics () {
   static_asm_fn ();
diff --git a/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-1_0.c 
b/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-1_0.c
index cd8ddfa7a0f5..ed97073521f9 100644
--- a/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-1_0.c
+++ b/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-1_0.c
@@ -1,6 +1,7 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options { {-O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=1to1 -no-pie} {-O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=max -no-pie} {-O2 -flto -flto-toplevel-asm-heuristics 
-flto-partition=cache -no-pie}} } */
 /* { dg-skip-if "SPARC relocation overflow" { sparc*-*-solaris2* && lp64 } } */
+/* { dg-skip-if "no-pie unsupported" { *-*-darwin* } "" "" } */
 
 void asm_fn();
 void asm_fn_used();
diff --git a/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-2_1.c 
b/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-2_1.c
index 1d7c37989637..f37e17d52ec7 100644
--- a/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-2_1.c
+++ b/gcc/testsuite/gcc.dg/lto/toplevel-simple-asm-2_1.c
@@ -1,10 +1,19 @@
 extern void static_asm_fn ();
 extern int static_asm_var;
+#if __APPLE__
+asm("_static_asm_fn:");
+asm("_static_asm_var:");
+#else
 asm("static_asm_fn:");
 asm("static_asm_var:");
+#endif
 
 extern int asm_var;
+#if __APPLE__
+asm(".globl _asm_var\n_asm_var:");
+#else
 asm(".global asm_var\nasm_var:");
+#endif
 
 int use_statics () {
   static_asm_fn ();

Reply via email to