From: Simon Marchi <simark@simark.ca>
To: Bratislav Filipovic <bfilipov@amd.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] testsuite: Skip fission-dw-form-strx with clang
Date: Thu, 16 Apr 2026 11:19:59 -0400 [thread overview]
Message-ID: <ac4988fb-ee1c-40e8-af8b-b33d95d2fb4d@simark.ca> (raw)
In-Reply-To: <20260416140306.1556274-1-bfilipov@amd.com>
On 4/16/26 10:00 AM, Bratislav Filipovic wrote:
> Clang's integrated assembler incorrectly sets the SHF_EXCLUDE flag
> on .debug_*.dwo sections when assembling DWARF fission debug info.
> This causes all linkers (both lld and GNU ld) to strip these
> sections from the final output, breaking the test.
>
> This is a limitation of clang's integrated assembler, not a GDB
> issue. The test works correctly with GCC's assembler, which does
> not set this flag.
>
> A workaround exists (-fno-integrated-as to use GNU's external
> assembler), but it is not practical to apply in the testsuite.
> Therefore, restrict this test to GCC only.
> ---
>
> I've investigated this thoroughly and found that clang's integrated
> assembler hardcodes the SHF_EXCLUDE flag on .debug_*.dwo sections.
> The only workaround I found is -fno-integrated-as, which forces clang
> to use GNU's external assembler.
>
> Does anyone have suggestions for making this test work with clang
> without skipping it entirely? Or should we report this to LLVM as a bug?
Can you explain what is the sequence of compiling / linking steps in
this test? Normally, I think that .dwo sections are not meant to go
through a linker. This is how gcc works:
- cc1 compiler produces a .o file containing .dwo sections
- objcopy extracts the .dwo sections to a .dwo file using --extract-dwo
- objcopy strips the .dwo sections from the .o file using --strip-dwo
- linker links the final executable from the .o files, without the .dwo
sections
I don't know how clang operates, but it seems fine for the .dwo sections
to have SHF_EXCLUDE: if they are still present at the link step, we
don't want them to end up in the final executable.
If we see that in this test the .dwo sections go through the linker and
get discarded, it might be the test that is doing things wrong.
See the commit log here for example:
https://gitlab.com/gnutools/binutils-gdb/-/commit/6a29913eeb98595b76a7c5a3b3c2c4464c7c1484
In this commit, I fixed a test (that I had written myself initially,
before understanding the .dwo flow I described above) that was running
the .dwo sections through the linker, and that was causing other
problems.
Simon
prev parent reply other threads:[~2026-04-16 15:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 14:00 Bratislav Filipovic
2026-04-16 14:45 ` Guinevere Larsen
2026-04-16 15:19 ` Simon Marchi [this message]
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=ac4988fb-ee1c-40e8-af8b-b33d95d2fb4d@simark.ca \
--to=simark@simark.ca \
--cc=bfilipov@amd.com \
--cc=gdb-patches@sourceware.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