From: Tom Tromey Date: Fri, 23 May 2025 23:48:30 +0000 (-0600) Subject: Use "MS" for .debug_str X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=baba7c9a2ae10eb19c8eff6f5c981268b1f3831e;p=thirdparty%2Fbinutils-gdb.git Use "MS" for .debug_str I changed my system linker to 'mold', but then I saw some gdb test failures. This patch fixes a subset of the failures. dw2-strp.exp was failing, and investigating showed that there were two .debug_str sections. I tracked this down to the .S file not using the correct section flags. This patch fixes this problem, plus the other instances I could find. (Strangely, these did not all cause problems, however.) I also changed the DWARF assembler to always use these flags for .debug_str. --- diff --git a/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S b/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S index c09c6dbbc5d..06a93ac3086 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S +++ b/gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S @@ -114,7 +114,11 @@ die221: .byte 0x0 - .section .debug_str +#ifdef __arm__ + .section .debug_str,"MS",%progbits,1 +#else + .section .debug_str,"MS",@progbits,1 +#endif .LASF1: .string "2.mod" .LASF0: diff --git a/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S b/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S index cd999f4f86b..551dda72da4 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S +++ b/gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S @@ -160,7 +160,11 @@ d: .byte 0 .byte 0 .byte 0 - .section .debug_str +#ifdef __arm__ + .section .debug_str,"MS",%progbits,1 +#else + .section .debug_str,"MS",@progbits,1 +#endif .LASF2: .string "GNU C 4.7.0 20110727 (experimental)" .LASF0: diff --git a/gdb/testsuite/gdb.dwarf2/dw2-strp.S b/gdb/testsuite/gdb.dwarf2/dw2-strp.S index c7ede95293c..db3e64fd342 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-strp.S +++ b/gdb/testsuite/gdb.dwarf2/dw2-strp.S @@ -163,7 +163,11 @@ .byte 0x0 /* Terminator */ /* String table */ - .section .debug_str +#ifdef __arm__ + .section .debug_str,"MS",%progbits,1 +#else + .section .debug_str,"MS",@progbits,1 +#endif .Lproducer: .string "GNU C 3.3.3" .Lchar_str: diff --git a/gdb/testsuite/gdb.dwarf2/pr11465.S b/gdb/testsuite/gdb.dwarf2/pr11465.S index fed98bc121e..f3f2c57745f 100644 --- a/gdb/testsuite/gdb.dwarf2/pr11465.S +++ b/gdb/testsuite/gdb.dwarf2/pr11465.S @@ -344,7 +344,11 @@ die149: .uleb128 0x16 /* DW_TAG_variable */ .byte 0x0 .byte 0x0 .byte 0x0 - .section .debug_str +#ifdef __arm__ + .section .debug_str,"MS",%progbits,1 +#else + .section .debug_str,"MS",@progbits,1 +#endif .LASF0: .string "_ZN1N1fE" .LASF7: diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index 4d224cdae75..3a182c22ea0 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -1072,7 +1072,10 @@ namespace eval Dwarf { } proc _section {name {flags ""} {type ""}} { - if {$flags == "" && $type == ""} { + if {$name == ".debug_str"} { + # Hard-code this because it's always desirable. + _emit " .section $name, \"MS\", %progbits, 1" + } elseif {$flags == "" && $type == ""} { _emit " .section $name" } elseif {$type == ""} { _emit " .section $name, \"$flags\""