public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "iains at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug testsuite/95577] Tcl error with testsuite/gcc.misc-tests/outputs.exp on darwin
Date: Tue, 23 Jun 2020 11:45:11 +0000	[thread overview]
Message-ID: <bug-95577-4-cDpYrGOFPL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95577-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Alexandre Oliva from comment #3)
> Iain,
> 
> Do platforms that use dsymutil support -gsplit-dwarf?

None I am aware of - Darwin should reject -gsplit-dwarf with a diagnostic, so
that configuration should detect missing support correctly there.

> I'm thinking of bringing -g into the gsplit_dwarf variable, so it won't be
> enable without -gsplit-dwarf, and removing other explicit mentions of -g
> from outputs.exp.
> 
> Would this be enough to address the dsymutil left-overs?

I don't think so (hence the code to detect -g* and delete the .dSYM if one is
seen).

======

The motivation for Darwin's 'split' debug is actually different from the
-gsplit-dwarf (and it doesn't solve the object size problem that split dwarf
does).

For the record - the Darwin behaviour is like this;

[when debug is enabled] the static linker [ld64] embeds a list of contributing
object file paths into the executable.  It does not link or include any debug
in the exe (this saves time).

dsymutil [the debug linker] takes the executable, looks up the list of object
files and produces a linked debug object, this is placed into a Darwin file
package (a directory structure with some metadata embedded + the object).  This
is named <exe>.dSYM <= but it's a file package, so has to be deleted like a
directory.

On Darwin, debug consumers have two options;

1. Use the table in the exe to pull the debug data directly from the
contributing objects (i.e. never do an actual debug link but just dynamically
satisfy those symbols the user inspects).
  - LLDB and GDB both grok this (newer GDBs might have bit-rotted somewhat
since Adacore is no longer maintaining the Darwin binutils stuff and I am
totally out of cycles to contribute).

2. If the the debug linker has been run and the .dSYM is available, they can
use that.

1) is very efficient for large projects with many object files with long debug
link times, since that stage of linking can be omitted in the
compile/edit/debug loop.

-----

BUT, then there's one case where (1) doesn't work - which is when the user
does;

 gcc foo.c bar.o ..... -g -o x

because the object file created for any source on the command line is
ephemeral, and thus if it's put into the exe that doesn't help - because it
won't be available at debug time.

So Darwin's linker spec force dsymutil to be run for any compile line that
includes a source file, this is a very common circumstance in the test suite,
leading to many .dSYM files that need to be removed.

The patch fragment at comment #1 addresses this for these tests (and Dominque
has a larger patch [which I need to look at] to clean it up in more places in
the test suite).

  parent reply	other threads:[~2020-06-23 11:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 14:24 [Bug testsuite/95577] New: " dominiq at lps dot ens.fr
2020-06-08 15:06 ` [Bug testsuite/95577] " iains at gcc dot gnu.org
2020-06-09  7:36 ` iains at gcc dot gnu.org
2020-06-23 11:17 ` aoliva at gcc dot gnu.org
2020-06-23 11:45 ` iains at gcc dot gnu.org [this message]
2020-06-23 13:16 ` aoliva at gcc dot gnu.org
2020-06-23 13:31 ` iains at gcc dot gnu.org
2020-06-23 13:58 ` aoliva at gcc dot gnu.org
2020-06-23 16:42 ` dominiq at lps dot ens.fr
2020-06-24 20:24 ` cvs-commit at gcc dot gnu.org
2020-06-24 20:41 ` aoliva at gcc dot gnu.org

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=bug-95577-4-cDpYrGOFPL@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).