The Darwin toolchains have a separate debug linker (dsymutil) so that the
link-time penalty for debug data is not usually seen.  At present, it's not
clear how we would support split DWARF on Darwin (or if it would bring
any additional benefit over dsymutil).

This patch produces diagnostic output to note that it's not supported and
disables it.  We also skip test cases that invoke -gsplit-dwarf.

NOTE that the tests failed because of PR81685 and this fix will need to
be back-ported after the fix for 81685.

OK for trunk?
affected branches (7,8)?

thanks
Iain

gcc/

   config/darwin.c
   config/darwin.h

gcc/testsuite/

  g++.dg/debug/dwarf2/pr85302.C
  gcc.dg/lto/pr83719_0.c
  gcc.dg/pr86064.c
---
 gcc/config/darwin.c                         | 8 ++++++++
 gcc/config/darwin.h                         | 5 ++++-
 gcc/testsuite/g++.dg/debug/dwarf2/pr85302.C | 1 +
 gcc/testsuite/gcc.dg/lto/pr83719_0.c        | 1 +
 gcc/testsuite/gcc.dg/pr86064.c              | 1 +
 5 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index db988850fd..41a1cef250 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -3190,6 +3190,14 @@ darwin_override_options (void)
   if (!global_options_set.x_dwarf_version)
     dwarf_version = 2;
 
+  if (global_options_set.x_dwarf_split_debug_info)
+    {
+      inform (input_location,
+             "-gsplit-dwarf is not supported on this platform, ignored");
+      dwarf_split_debug_info = 0;
+      global_options_set.x_dwarf_split_debug_info = 0;
+    }
+
   /* Do not allow unwind tables to be generated by default for m32.  
      fnon-call-exceptions will override this, regardless of what we do.  */
   if (generating_for_darwin_version < 10
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index bec19b6488..f954ba3cab 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -122,7 +122,8 @@ extern GTY(()) int darwin_ms_struct;
   "%{gfull:-g -fno-eliminate-unused-debug-symbols} %<gfull",   \
   "%{gused:-g -feliminate-unused-debug-symbols} %<gused",      \
   "%{fapple-kext|mkernel:-static}",                            \
-  "%{shared:-Zdynamiclib} %<shared"
+  "%{shared:-Zdynamiclib} %<shared",                            \
+  "%{gsplit-dwarf:%ngsplit-dwarf is not supported on this platform } 
%<gsplit-dwarf"
 
 #define DARWIN_CC1_SPEC                                                        
\
   "%{findirect-virtual-calls: -fapple-kext} %<findirect-virtual-calls " \
@@ -424,6 +425,8 @@ extern GTY(()) int darwin_ms_struct;
    debugging data.  */
 
 #define ASM_DEBUG_SPEC  "%{g*:%{%:debug-level-gt(0):%{!gdwarf*:--gstabs}}}"
+#define ASM_FINAL_SPEC \
+  "%{gsplit-dwarf:%ngsplit-dwarf is not supported on this platform } 
%<gsplit-dwarf"
 
 /* We still allow output of STABS if the assembler supports it.  */
 #ifdef HAVE_AS_STABS_DIRECTIVE
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr85302.C 
b/gcc/testsuite/g++.dg/debug/dwarf2/pr85302.C
index 97ac302a92..457508dd58 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/pr85302.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr85302.C
@@ -1,5 +1,6 @@
 // PR debug/85302
 // { dg-do compile }
+// { dg-skip-if "split DWARF unsupported" { *-*-darwin* } }
 // { dg-options "-std=c++11 -gsplit-dwarf -O1" }
 // { dg-additional-options "-fPIE" { target pie } }
 
diff --git a/gcc/testsuite/gcc.dg/lto/pr83719_0.c 
b/gcc/testsuite/gcc.dg/lto/pr83719_0.c
index 6d5c16da7d..cd4cab369a 100644
--- a/gcc/testsuite/gcc.dg/lto/pr83719_0.c
+++ b/gcc/testsuite/gcc.dg/lto/pr83719_0.c
@@ -1,4 +1,5 @@
 /* { dg-lto-do assemble } */
+/* { dg-skip-if "split DWARF unsupported" { *-*-darwin* } } */
 /* { dg-lto-options { { -flto -g -gsplit-dwarf } } } */
 
 /* Empty.  */
diff --git a/gcc/testsuite/gcc.dg/pr86064.c b/gcc/testsuite/gcc.dg/pr86064.c
index 5be820c78f..3397427256 100644
--- a/gcc/testsuite/gcc.dg/pr86064.c
+++ b/gcc/testsuite/gcc.dg/pr86064.c
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-skip-if "split DWARF unsupported" { *-*-darwin* } } */
 /* { dg-options "-g -O2 -fno-var-tracking-assignments -gsplit-dwarf" } */
 
 /* This used to fail with location views (implicitly) enabled, because
-- 
2.17.1


Reply via email to