* [PATCH] testsuite: Skip fission-dw-form-strx with clang
@ 2026-04-16 14:00 Bratislav Filipovic
2026-04-16 14:45 ` Guinevere Larsen
2026-04-16 15:19 ` Simon Marchi
0 siblings, 2 replies; 3+ messages in thread
From: Bratislav Filipovic @ 2026-04-16 14:00 UTC (permalink / raw)
To: gdb-patches; +Cc: Bratislav Filipovic
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?
gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp b/gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp
index b0b842fe911..fb39cab9c75 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp
@@ -20,6 +20,13 @@ load_lib dwarf.exp
# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support
+# This test requires GCC. Clang's integrated assembler incorrectly sets
+# the SHF_EXCLUDE flag on .debug_*.dwo sections, causing linkers to strip
+# them from the final output. This is a limitation of clang's integrated
+# assembler, not a GDB issue. The workaround (-fno-integrated-as) is not
+# practical for the testsuite.
+require {[test_compiler_info {gcc-*}]}
+
standard_testfile main.c -dw.S -dwo.S
set main_asm_file [standard_output_file $srcfile2]
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] testsuite: Skip fission-dw-form-strx with clang
2026-04-16 14:00 [PATCH] testsuite: Skip fission-dw-form-strx with clang Bratislav Filipovic
@ 2026-04-16 14:45 ` Guinevere Larsen
2026-04-16 15:19 ` Simon Marchi
1 sibling, 0 replies; 3+ messages in thread
From: Guinevere Larsen @ 2026-04-16 14:45 UTC (permalink / raw)
To: Bratislav Filipovic, gdb-patches
On 4/16/26 11: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?
My approach for these kinds of things in the past was to open a bug with
LLVM and mark the tests as XFAIL in our testsuite (at least if the rest
of the test still make sense to run)
>
> gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp b/gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp
> index b0b842fe911..fb39cab9c75 100644
> --- a/gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp
> +++ b/gdb/testsuite/gdb.dwarf2/fission-dw-form-strx.exp
> @@ -20,6 +20,13 @@ load_lib dwarf.exp
> # This test can only be run on targets which support DWARF-2 and use gas.
> require dwarf2_support
>
> +# This test requires GCC. Clang's integrated assembler incorrectly sets
> +# the SHF_EXCLUDE flag on .debug_*.dwo sections, causing linkers to strip
> +# them from the final output. This is a limitation of clang's integrated
> +# assembler, not a GDB issue. The workaround (-fno-integrated-as) is not
> +# practical for the testsuite.
> +require {[test_compiler_info {gcc-*}]}
> +
> standard_testfile main.c -dw.S -dwo.S
>
> set main_asm_file [standard_output_file $srcfile2]
--
Cheers,
Guinevere Larsen
It/she
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] testsuite: Skip fission-dw-form-strx with clang
2026-04-16 14:00 [PATCH] testsuite: Skip fission-dw-form-strx with clang Bratislav Filipovic
2026-04-16 14:45 ` Guinevere Larsen
@ 2026-04-16 15:19 ` Simon Marchi
1 sibling, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2026-04-16 15:19 UTC (permalink / raw)
To: Bratislav Filipovic, gdb-patches
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-16 15:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-16 14:00 [PATCH] testsuite: Skip fission-dw-form-strx with clang Bratislav Filipovic
2026-04-16 14:45 ` Guinevere Larsen
2026-04-16 15:19 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox