https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95577

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-06-08
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
             Target|x86_64-apple-darwin*        |*-*-darwin*
               Host|x86_64-apple-darwin*        |*-*-darwin*
              Build|x86_64-apple-darwin*        |*-*-darwin*
   Target Milestone|---                         |11.0

--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> ---
Darwin always separates debug info into a separate package (this is a directory
structure named exe.dSYM, for an exe name exe) [somewhat like split-dwarf, but
not optional or controlled by any command line flag]

This output is produced by the debug linker (dsymutil) any time that there is a
debug option on the command line + a source file, for which the object would be
temporary.

the failure mentioned occurs because the debug files are not being checked for
or deleted (and they are directory packages so that we need to use a suitable
delete).

this (first Part of the ) problem is fixed by the fragment below (Dominque's
patch + a tweak from me).

This then reveals a second issue - which is that the LTO tests are witten to
assume that the target generates thin LTO objects by default (which is true for
Linux but not for Darwin).  

The second problem can be catered for with a much longer patch which
essentially repeats the LTO tests for targets with/without fat-lto-objects. 
This seems a bit clunky and maybe there can be a better solution (maybe there
should also be a token test or two for linux using -ffat-lto-objects).

------

diff --git a/gcc/testsuite/gcc.misc-tests/outputs.exp
b/gcc/testsuite/gcc.misc-tests/outputs.exp
index 06a32dbeb9e..b3a1913f96c 100644
--- a/gcc/testsuite/gcc.misc-tests/outputs.exp
+++ b/gcc/testsuite/gcc.misc-tests/outputs.exp
@@ -43,6 +43,7 @@ if ![check_no_compiler_messages gsplitdwarf object {
 # Check for -flto support.  We explicitly test the result to skip
 # tests that use -flto.
 set skip_lto ![check_effective_target_lto]
+set target_lto_linker_plugin [check_linker_plugin_available]

 # Prepare additional options to be used for linking.
 # We do not compile to an executable, because that requires naming an output.
@@ -105,8 +106,12 @@ proc outest { test sources opts dirs outputs } {
        }
     }
     set options ""
+    set saw_debug 0
     foreach opt [split $opts " "] {
        append options " additional_flags=$opt"
+       if {[string match "-g*" "$opt"]} {
+           set saw_debug 1
+       }
     }
     # Add linker flags if we're linking
     if {![string match "* -\[ESc\] *" " $opts "]} {
@@ -143,6 +148,12 @@ proc outest { test sources opts dirs outputs } {
            if { [file exists $d$o] } then {
                pass "$test: $d$o"
                file delete $d$o
+               if { $saw_debug && [file exists $d$o.dSYM]} {
+                   # Darwin split debug directory packages, expected for
+                   # any case where debug is enabled for a single-file
+                   # test.
+                   file delete -force $d$o.dSYM
+               }
            } else {
                set ogl [glob -nocomplain -path $d -- $o]
                if { $ogl != {} } {

Reply via email to