public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <iains.gcc@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: fxcoudert@gmail.com
Subject: [pushed] Darwin: Do not emit .macinfo when dsymutil cannot consume it.
Date: Tue,  2 Apr 2024 12:22:35 +0100	[thread overview]
Message-ID: <20240402112235.86535-1-iain@sandoe.co.uk> (raw)

This causes quite a number of testsuite fails on systems using Xcode 15.
More significantly, it is a serious debug regression (since the entire
debug is ignored when macinfo is seen).

tested on x86_64-darwin17,21,23 with / without Xcode-15, pushed to trunk,
thanks
Iain

--- 8< ---

Some verions of dsymutil do not ignore .macinfo sections, but instead
ignore the entire debug in the file.

To avoid this total loss of debug, when we detect that the debug level
is g3 and the dsymutil version cannot support it, we reduce the level
to g2 and issue a note.

This behaviour can be overidden by -gstrict-dwarf (although the objects
will contain macinfo; dsymutil will not produce a .dSYM with it).

gcc/ChangeLog:

	* config/darwin.cc (darwin_override_options): Reduce the debug
	level to 2 if dsymutil cannot handle .macinfo sections.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
---
 gcc/config/darwin.cc | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/gcc/config/darwin.cc b/gcc/config/darwin.cc
index 9e5d64e6f32..c37a1a4756f 100644
--- a/gcc/config/darwin.cc
+++ b/gcc/config/darwin.cc
@@ -3415,11 +3415,6 @@ darwin_override_options (void)
 		  global_options.x_flag_objc_abi);
     }
 
-  /* Limit DWARF to the chosen version, the linker and debug linker might not
-     be able to consume newer structures.  */
-  if (!OPTION_SET_P (dwarf_strict))
-    dwarf_strict = 1;
-
   if (!OPTION_SET_P (dwarf_version))
     {
       /* External toolchains based on LLVM or clang 7+ have support for
@@ -3442,6 +3437,24 @@ darwin_override_options (void)
       OPTION_SET_P (dwarf_split_debug_info) = 0;
     }
 
+  /* Cases where dsymutil will exclude files with .macinfo sections; we are
+     better off forcing the debug level to 2 than completely excluding the
+     files.  If strict dwarf is set, then emit the macinfo anyway.  */
+  if (debug_info_level == DINFO_LEVEL_VERBOSE
+      && (!OPTION_SET_P (dwarf_strict) || dwarf_strict == 0)
+      && ((dsymutil_version.kind == CLANG && dsymutil_version.major >= 1500)
+	  || (dsymutil_version.kind == LLVM && dsymutil_version.major >= 15)))
+    {
+      inform (input_location,
+	      "%<-g3%> is not supported by the debug linker in use (set to 2)");
+      debug_info_level = DINFO_LEVEL_NORMAL;
+    }
+
+  /* Limit DWARF to the chosen version, the linker and debug linker might not
+     be able to consume newer structures.  */
+  if (!OPTION_SET_P (dwarf_strict))
+    dwarf_strict = 1;
+
   /* 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
-- 
2.39.2 (Apple Git-143)


                 reply	other threads:[~2024-04-02 11:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240402112235.86535-1-iain@sandoe.co.uk \
    --to=iains.gcc@gmail.com \
    --cc=fxcoudert@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iain@sandoe.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).