public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/95482] New: Feature request: add -gsplit-dwarf=single
@ 2020-06-02 17:03 i at maskray dot me
  2020-06-03  6:03 ` [Bug debug/95482] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: i at maskray dot me @ 2020-06-02 17:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95482
           Summary: Feature request: add -gsplit-dwarf=single
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: i at maskray dot me
  Target Milestone: ---

DWARF v5 Appendix F. says

> The sections that do not require relocation, however, can be written to the relocatable object (.o) file but ignored by the linker, or they can be written to a separate DWARF object (.dwo) file that need not be accessed by the linker.

GCC/clang -gsplit-dwarf write a separate DWARF object (.dwo)

clang in addition supports -gsplit-dwarf=single
(https://reviews.llvm.org/D52296 ) to write the sections (with the SHF_EXCLUDE
flag) in the .o file.
Linkers ignore SHF_EXCLUDE sections in non -r mode.

Note, SHF_EXCLUDE (0x80000000) is in the range of processor-specific bits and
clashes with several processors's (obsoleted?) flags (see
https://sourceware.org/pipermail/binutils/2020-April/110691.html )

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug debug/95482] Feature request: add -gsplit-dwarf=single
  2020-06-02 17:03 [Bug debug/95482] New: Feature request: add -gsplit-dwarf=single i at maskray dot me
@ 2020-06-03  6:03 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-03  6:03 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC does not by itself generate the separate .dwo file but instead the driver,
after the assembler finished, runs objcopy via ASM_FINAL_SPEC:

/* config.h can define ASM_FINAL_SPEC to run a post processor after
   the assembler has run.  */
#ifndef ASM_FINAL_SPEC
#define ASM_FINAL_SPEC \
  "%{gsplit-dwarf: \n\
       objcopy --extract-dwo \
         %{c:%{o*:%*}%{!o*:%w%b%O}}%{!c:%U%O} \
         %b.dwo \n\
       objcopy --strip-dwo \
         %{c:%{o*:%*}%{!o*:%w%b%O}}%{!c:%U%O} \
    }"
#endif

so I would guess there's only small massaging necessary to get the desired
functionality (the sections are already marked SHF_EXCLUDE).  Patches welcome,
just figure out the correct magic to guard the SPEC above, like maybe
"%{!gsplit-dwarf=single: %{gsplit-dwarf: ...

The choice of -gsplit-dwarf=single is probably not too nice here though.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-03  6:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 17:03 [Bug debug/95482] New: Feature request: add -gsplit-dwarf=single i at maskray dot me
2020-06-03  6:03 ` [Bug debug/95482] " rguenth at gcc dot gnu.org

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).