diff mbox series

[pushed] Darwin : Adjust defaults for current bootstrap constraints.

Message ID E3EBA510-D890-459B-B779-246602D30854@sandoe.co.uk
State New
Headers show
Series [pushed] Darwin : Adjust defaults for current bootstrap constraints. | expand

Commit Message

Iain Sandoe Jan. 2, 2021, 8:01 p.m. UTC
Hi,

Part of fixing up headers to handle Darwin20.

The toolchain now requires a C++11 compiler to bootstrap and
none of the older Darwin toolchains which were based on stabs
debugging are suitable.  We can simplify the debug setup now.

tested on darwin8, 9, 16, 18, 20 x86_64-linux-gnu
pushed to master
thanks
Iain

gcc/ChangeLog:

	* config/darwin.h (DSYMUTIL_SPEC): Default to DWARF
	(ASM_DEBUG_SPEC):Only define if the assembler supports
	stabs.
	(PREFERRED_DEBUGGING_TYPE): Default to DWARF.
	(DARWIN_PREFER_DWARF): Define.
	* config/darwin9.h (PREFERRED_DEBUGGING_TYPE): Remove.
	(DARWIN_PREFER_DWARF): Likewise
	(DSYMUTIL_SPEC): Likewise.
	(COLLECT_RUN_DSYMUTIL): Likewise.
	(ASM_DEBUG_SPEC): Likewise.
	(ASM_DEBUG_OPTION_SPEC): Likewise.
---
 gcc/config/darwin.h  | 37 ++++++++++++++++++++++++++-----------
 gcc/config/darwin9.h | 26 --------------------------
 2 files changed, 26 insertions(+), 37 deletions(-)
diff mbox series

Patch

diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index da40a08443e..93e7796e850 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -241,12 +241,18 @@  extern GTY(()) int darwin_ms_struct;
 
 #define DSYMUTIL "\ndsymutil"
 
+/* Spec that controls whether the debug linker is run automatically for
+   a link step.  This needs to be done if there is a source file on the
+   command line which will result in a temporary object (and debug is
+   enabled).  */
+
 #define DSYMUTIL_SPEC \
    "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
     %{v} \
-    %{gdwarf-2:%{!gstabs*:%{%:debug-level-gt(0): -idsym}}}\
-    %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm: \
-    %{gdwarf-2:%{!gstabs*:%{%:debug-level-gt(0): -dsym}}}}}}}}}}}"
+    %{g*:%{!gstabs*:%{%:debug-level-gt(0): -idsym}}}\
+    %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm|.s|.f|.f90|\
+      .f95|.f03|.f77|.for|.F|.F90|.F95|.F03: \
+    %{g*:%{!gstabs*:%{%:debug-level-gt(0): -dsym}}}}}}}}}}}"
 
 #define LINK_COMMAND_SPEC LINK_COMMAND_SPEC_A DSYMUTIL_SPEC
 
@@ -472,22 +478,31 @@  extern GTY(()) int darwin_ms_struct;
   %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
   %{static}" ASM_MMACOSX_VERSION_MIN_SPEC
 
-/* Default ASM_DEBUG_SPEC.  Darwin's as cannot currently produce dwarf
-   debugging data.  */
-
+#ifdef HAVE_AS_STABS_DIRECTIVE
+/* We only pass a debug option to the assembler if that supports stabs, since
+   dwarf is not uniformly supported in the assemblers.  */
 #define ASM_DEBUG_SPEC  "%{g*:%{%:debug-level-gt(0):%{!gdwarf*:--gstabs}}}"
-#define ASM_DEBUG_OPTION_SPEC ""
+#else
+#define ASM_DEBUG_SPEC  ""
+#endif
+
+#undef  ASM_DEBUG_OPTION_SPEC
+#define ASM_DEBUG_OPTION_SPEC	""
+
 #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.  */
+/* We now require C++11 to bootstrap and newer tools than those based on
+   stabs, so require DWARF-2, even if stabs is supported by the assembler.  */
+
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+#define DARWIN_PREFER_DWARF
+#define DWARF2_DEBUGGING_INFO 1
+
 #ifdef HAVE_AS_STABS_DIRECTIVE
 #define DBX_DEBUGGING_INFO 1
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
 #endif
 
-#define DWARF2_DEBUGGING_INFO 1
-
 #define DEBUG_FRAME_SECTION	  "__DWARF,__debug_frame,regular,debug"
 #define DEBUG_INFO_SECTION	  "__DWARF,__debug_info,regular,debug"
 #define DEBUG_ABBREV_SECTION	  "__DWARF,__debug_abbrev,regular,debug"
diff --git a/gcc/config/darwin9.h b/gcc/config/darwin9.h
index 787aca72435..6576d386c12 100644
--- a/gcc/config/darwin9.h
+++ b/gcc/config/darwin9.h
@@ -18,32 +18,6 @@  You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-/* Prefer DWARF2.  */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
-#define DARWIN_PREFER_DWARF
-
-/* Since DWARF2 is default, conditions for running dsymutil are different.  */
-#undef DSYMUTIL_SPEC
-#define DSYMUTIL_SPEC \
-   "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
-    %{v} \
-    %{g*:%{!gstabs*:%{%:debug-level-gt(0): -idsym}}}\
-    %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm|.s|.f|.f90|.f95|.f03|.f77|.for|.F|.F90|.F95|.F03: \
-    %{g*:%{!gstabs*:%{%:debug-level-gt(0): -dsym}}}}}}}}}}}"
-
-/* Tell collect2 to run dsymutil for us as necessary.  */
-#define COLLECT_RUN_DSYMUTIL 1
-
-/* Only ask as for debug data if the debug style is stabs (since as doesn't
-   yet generate dwarf.)  */
-
-#undef  ASM_DEBUG_SPEC
-#define ASM_DEBUG_SPEC  "%{g*:%{%:debug-level-gt(0):%{gstabs:--gstabs}}}"
-
-#undef  ASM_DEBUG_OPTION_SPEC
-#define ASM_DEBUG_OPTION_SPEC	""
-
 #undef  ASM_OUTPUT_ALIGNED_COMMON
 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
   do {									\