public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: David Blaikie <dblaikie@gmail.com>
Cc: Alexander Yermolovich <ayermolo@fb.com>,
	Jakub Jelinek <jakub@redhat.com>, Mark Wielaard <mark@klomp.org>,
	"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>,
	"ikudrin@accesssoftek.com" <ikudrin@accesssoftek.com>,
	 "maskray@google.com" <maskray@google.com>
Subject: Re: DWARF64 gcc/clang flag discussion
Date: Fri, 4 Dec 2020 09:36:05 +0100	[thread overview]
Message-ID: <CAFiYyc2Bmw78SiWDRJk=aqueoC-Z97SjTLne5P4JOc54_mMsMg@mail.gmail.com> (raw)
In-Reply-To: <CAENS6EvJMA1KPz0GCEWD_PjRFCdURb68t-bJTnMcyDbNDqUEtQ@mail.gmail.com>

On Thu, Dec 3, 2020 at 6:52 PM David Blaikie <dblaikie@gmail.com> wrote:

>
>
> On Wed, Dec 2, 2020 at 5:10 PM Alexander Yermolovich <ayermolo@fb.com>
> wrote:
>
>>
>>
>> ------------------------------
>> *From:* David Blaikie <dblaikie@gmail.com>
>> *Sent:* Wednesday, December 2, 2020 1:12 PM
>> *To:* Alexander Yermolovich <ayermolo@fb.com>
>> *Cc:* Richard Biener <richard.guenther@gmail.com>; Jakub Jelinek <
>> jakub@redhat.com>; Mark Wielaard <mark@klomp.org>; gcc@gcc.gnu.org <
>> gcc@gcc.gnu.org>; ikudrin@accesssoftek.com <ikudrin@accesssoftek.com>;
>> maskray@google.com <maskray@google.com>
>> *Subject:* Re: DWARF64 gcc/clang flag discussion
>>
>>
>>
>> On Wed, Dec 2, 2020 at 10:44 AM Alexander Yermolovich <ayermolo@fb.com>
>> wrote:
>>
>>
>>
>> ------------------------------
>> *From:* David Blaikie <dblaikie@gmail.com>
>> *Sent:* Tuesday, December 1, 2020 10:33 AM
>> *To:* Alexander Yermolovich <ayermolo@fb.com>
>> *Cc:* Richard Biener <richard.guenther@gmail.com>; Jakub Jelinek <
>> jakub@redhat.com>; Mark Wielaard <mark@klomp.org>; gcc@gcc.gnu.org <
>> gcc@gcc.gnu.org>; ikudrin@accesssoftek.com <ikudrin@accesssoftek.com>;
>> maskray@google.com <maskray@google.com>
>> *Subject:* Re: DWARF64 gcc/clang flag discussion
>>
>>
>>
>> On Mon, Nov 30, 2020 at 5:04 PM Alexander Yermolovich <ayermolo@fb.com>
>> wrote:
>>
>>
>>
>> ------------------------------
>> *From:* David Blaikie <dblaikie@gmail.com>
>> *Sent:* Monday, November 30, 2020 12:09 PM
>> *To:* Alexander Yermolovich <ayermolo@fb.com>
>> *Cc:* Richard Biener <richard.guenther@gmail.com>; Jakub Jelinek <
>> jakub@redhat.com>; Mark Wielaard <mark@klomp.org>; gcc@gcc.gnu.org <
>> gcc@gcc.gnu.org>; ikudrin@accesssoftek.com <ikudrin@accesssoftek.com>;
>> maskray@google.com <maskray@google.com>
>> *Subject:* Re: DWARF64 gcc/clang flag discussion
>>
>> On Mon, Nov 30, 2020 at 11:36 AM Alexander Yermolovich <ayermolo@fb.com>
>> wrote:
>>
>> Thank you David for driving the conversation, sorry I was on vacation.
>>
>>
>> All good - really appreciate everyone chipping in whenever/however they
>> can!
>>
>>
>>
>> I guess discussion is from perspective of having both flags
>> gdwarf32/gdwarf64. In which case it's a valid question on whether they
>> should imply -g like -gdwarf-#.
>> But can this be viewed as only a -gdwarf64 flag, that is a qualifier to
>> other debug flags that enable debug information? DWARF spec says that 32bit
>> should be a default, and 64bit should be used rarely (paraphrasing). So
>> when user enabled debug information the default expectation is that it will
>> be 32bit. There is no real need for a flag to say "I want debug
>> information, and I want it 32bit".
>>
>>
>> I'm not quite with you here, I think. I believe it's important to be able
>> to opt into and out of things at any point on the command line - because of
>> how complex build systems build up command lines. You might have a
>> -gdwarf64 set as a project default, but for some reason want to opt into
>> -gdwarf32 in other parts (perhaps you're building the debug info for your
>> interface library you intend to ship to clients who might only have DWARF32
>> support, but your library is big and needs DWARF64 for the rest). A general
>> architectural principle of most command line arguments to the compiler is
>> that they can be opted into/out of fairly symmetrically (hence all the
>> -*no-* variant flags).
>>
>> [Alex] Ah I see, good point.
>>
>>
>> On the other hand, 64bit DWARF format must be enabled. So from users
>> perspective it's "I want debug information enabled for particular DWARF
>> version and level, oh and I want it to be 64bit".
>>
>>
>> But there's also the possibility of wanting to turn on DWARF64 for any
>> debug info in your build, but not necessarily wanting to turn on debug info
>> while doing so. Eg: you have a big build system, with a variety of users
>> and flags all over the place - maybe users opting in to -g2 on some files
>> and -g1 on others, and/or under different build modes. And the project as a
>> whole is reaching the DWARF64 tipping point and you'd like to say "if we're
>> generating DWARF, make it DWARF64". We've recently encountered this sort of
>> situation with -gsplit-dwarf and with -gdwarf-N (in switching to DWARFv5 we
>> had this situation where there's a big code base/build system with many
>> users, many uses of different -gN-type flags and it'd be impractical to go
>> and add -gdwarf-5 to all the -gN uses to make them all use DWARFv5, so we
>> added -fdebug-default-version=N (I might be misremembering the spelling) to
>> Clang to support this use case of "If we're generating DWARF, make it
>> DWARFv5")
>>
>> [Alex] I think we are saying similar thing. The -gdwarf64 doesn't enable
>> debug generation, but if it is enabled it will be 64bit. A "qualifier" of
>> sorts.
>>
>>
>> OK. My concern there, though I think it's the preferable semantics for
>> the -gdwarf64 flag when considered in isolation, is now -gdwarf64 and
>> -gdwarf-5 would have some fairly subtly different semantics (the latter
>> enables debug info and the former does not) in contrast to how close their
>> spelling is. (in addition to their general similarly maybe being a source
>> of confusion - even if the numbers aren't close to each other)
>> [Alex] That is a good point, but I guess broader question is if
>> precedence is not good, should we follow it? If it's clearly documented,
>> might be OK. As my professor Brian Harvey said many, many, many moons ago
>> during my undergrad: "RTFM". If my understanding of exchange on this thread
>> is correct, there doesn't seem to be a consensus on this point.
>>
>>
>> Re: lacking consensus: yep. That's my understanding.
>>
>> Admittedly my sort of wedge take on this is - why not use -f flags that
>> don't have the ambiguity/overlap with "maybe it enables debug info too". (&
>> maybe we could use -fdwarf32/64 in Clang, to avoid implementing
>> -gdwarf32/64 with a difference in behavior in terms of
>> also-enables-emission - then implement whatever semantics GCC ended up
>> picking) - well, "why not" because of the general take that debug info
>> flags should be "-g", fair enough.
>>
>> So, yeah, I'm still pretty undecided about how Clang should move forward
>> with this in the immediate future.
>> [Alex] Well if there is no consensus maybe clang can trail blaze. 🙂
>>
>
> My concern with doing so is both that GCC might not make the same
> decision, leading to differences in flag semantics (and my other concerns
> about the available options that lean towards the -g* style naming and the
> ambiguities around composability or implied -g in general and in particular
> with the likely names here and how close they are to existing names that do
> imply -g, hence my personal preference towards the -f names). Might end up
> going with the -f names out of a combination of my desire for clear
> designation of composability, and sidestepping the issue of GCC
> compatibility in the future if GCC's going to pick a -g name and semantics
> (implied -g or otherwise) anyway. This does mean I/we/clang loses a chance
> to perhaps somewhat more heavily (than just my words here) influence GCC's
> flag choice (eg: by Clang choosing the -g* naming and making it composable,
> for instance), but avoids the chance of divergent behavior between the two
> compilers, or breaking backwards compatibility to maintain compatibility.
>
> All up I just don't have great feelings about any of the paths forward,
> really. I think -fdwarf32/64 is the better option for users, that
> -gdwarf32/64 implying -g would be unfortunate (composability is valuable)
> and -gdwarf32/64 being composable would be pretty confusing to users given
> -gdwarf-N isn't composable & they are very similar flags/spellings
> (similarly for -g32/64 compared to -gN).
>
>
> Sorry, just going around in circles a bit, I guess this may be a better
> summary:
>   If I had to pick a -g flag/semantic for this, I guess I'd pick
> -gdwarf32/64 without implied -g. I'd pick that if I knew GCC would
> implement it to match - but if GCC might go either way on implied -g, I
> think I'd rather avoid changing the semantics of the flag later on & use a
> different name GCC isn't likely to define different semantics for (and I'd
> probably pick -fdwarf32/64).
>

There's an approved patch to add -gdwarf{32,64} not implying -g

Richard.


>
> - Dave
>
>>

  reply	other threads:[~2020-12-04  8:36 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 20:22 Alexander Yermolovich
2020-11-21  0:19 ` mark
2020-11-23  8:32   ` Richard Biener
2020-11-24  2:38     ` David Blaikie
2020-11-24  2:59       ` Jeff Law
2020-11-24  3:03         ` David Blaikie
2020-11-24  3:21           ` Jeff Law
2020-11-24  7:45       ` Jakub Jelinek
2020-11-24  7:50         ` Richard Biener
2020-11-24 11:04           ` Mark Wielaard
2020-11-24 11:11             ` Jakub Jelinek
2020-11-24 15:22               ` Jeff Law
2020-11-24 18:38               ` David Blaikie
2020-11-25  9:22                 ` Richard Biener
2020-11-25 21:46                   ` David Blaikie
2020-11-30 19:35                     ` Alexander Yermolovich
2020-11-30 20:08                       ` Fāng-ruì Sòng
2020-11-30 20:09                       ` David Blaikie
2020-12-01  1:04                         ` Alexander Yermolovich
2020-12-01 18:33                           ` David Blaikie
2020-12-02 18:43                             ` Alexander Yermolovich
2020-12-02 21:12                               ` David Blaikie
2020-12-03  1:10                                 ` Alexander Yermolovich
2020-12-03 17:52                                   ` David Blaikie
2020-12-04  8:36                                     ` Richard Biener [this message]
2020-12-04 18:01                                       ` Alexander Yermolovich
2020-12-07  7:14                                         ` Richard Biener
2020-12-07 11:22                                           ` Jakub Jelinek
2020-12-07 19:08                                             ` David Blaikie
2020-11-30 20:25                       ` Mark Wielaard
2020-11-24 18:32         ` David Blaikie
2020-11-24 18:59           ` Eric Botcazou

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='CAFiYyc2Bmw78SiWDRJk=aqueoC-Z97SjTLne5P4JOc54_mMsMg@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=ayermolo@fb.com \
    --cc=dblaikie@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=ikudrin@accesssoftek.com \
    --cc=jakub@redhat.com \
    --cc=mark@klomp.org \
    --cc=maskray@google.com \
    /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).