[Darwin] Do not run dsymutil automatically, when -save-temps is on the command line.

Message ID 820F4886-4F7F-44EA-AF84-05359791BF5B@sandoe.co.uk
State New
Headers show
Series
  • [Darwin] Do not run dsymutil automatically, when -save-temps is on the command line.
Related show

Commit Message

Iain Sandoe Aug. 18, 2018, 8:17 p.m.
Hi Folks,

The point of running dsymutil automatically from collect2 is that it
(collect2, lto-wrapper, etc) might be generating or using compiler
temporary files that will be deleted at the end of the link process.

dsymutil requires that it can see the objects actually used in the link
since it actually picks up the debug info from those, rather than the
linked exe.

When “-save-temps” is given, the objects should be preserved (if they
are not, then that’s a bug) and therefore we don’t need to run dsymutil
automatically.

The debug experience can be better with GDB + the original objects for
some permutations of dsymutil / GDB.

Opinions? 
Apply to trunk?

thanks
Iain

gcc/

 	* config/darwin.h (DSYMUTIL_SPEC): Don’t run dsymutil when
	 “-save-temps” is given.
	* config/darwin9.h: Likewise.

---
 gcc/config/darwin.h  | 4 ++--
 gcc/config/darwin9.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.17.1

Comments

Mike Stump Aug. 20, 2018, 6:19 p.m. | #1
On Aug 18, 2018, at 1:17 PM, Iain Sandoe <iain@sandoe.co.uk> wrote:
> 

> The point of running dsymutil automatically from collect2 is that it

> (collect2, lto-wrapper, etc) might be generating or using compiler

> temporary files that will be deleted at the end of the link process.

> 

> dsymutil requires that it can see the objects actually used in the link

> since it actually picks up the debug info from those, rather than the

> linked exe.

> 

> When “-save-temps” is given, the objects should be preserved (if they

> are not, then that’s a bug) and therefore we don’t need to run dsymutil

> automatically.

> 

> The debug experience can be better with GDB + the original objects for

> some permutations of dsymutil / GDB.

> 

> Opinions? 


So, I think of -save-temps as a debugging thing, and as such, kinda don't want it to change anything.  I don't think people use this in production to manage their builds.

I think it's an over optimization.

Patch

diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index e7cfd71de5..a6e9939d59 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -205,11 +205,11 @@  extern GTY(()) int darwin_ms_struct;
 #define DSYMUTIL "\ndsymutil"
 
 #define DSYMUTIL_SPEC \
-   "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
+   "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:%{!save-temps*: \
     %{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}}}}}}}}}}}"
+    %{gdwarf-2:%{!gstabs*:%{%:debug-level-gt(0): -dsym}}}}}}}}}}}}"
 
 #define LINK_COMMAND_SPEC LINK_COMMAND_SPEC_A DSYMUTIL_SPEC
 
diff --git a/gcc/config/darwin9.h b/gcc/config/darwin9.h
index 72f593951e..2e193f7513 100644
--- a/gcc/config/darwin9.h
+++ b/gcc/config/darwin9.h
@@ -26,11 +26,11 @@  along with GCC; see the file COPYING3.  If not see
 /* Since DWARF2 is default, conditions for running dsymutil are different.  */
 #undef DSYMUTIL_SPEC
 #define DSYMUTIL_SPEC \
-   "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
+   "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:%{!save-temps*: \
     %{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}}}}}}}}}}}"
+    %{g*:%{!gstabs*:%{%:debug-level-gt(0): -dsym}}}}}}}}}}}}"
 
 /* Tell collect2 to run dsymutil for us as necessary.  */
 #define COLLECT_RUN_DSYMUTIL 1