Tested on x86_64-darwin, pushed to trunk, thanks
Iain

--- 8< ---

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]>
---
 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 6082fbe1166..c4e9d536bdb 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 089ce2e0460..f3690d5675f 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 f0a6ec3fdf5..9d70ad5a5da 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 cd8ddfa7a0f..ed97073521f 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 1d7c3798963..f37e17d52ec 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 ();
-- 
2.50.1 (Apple Git-155)

Reply via email to