]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use "MS" for .debug_str
authorTom Tromey <tromey@adacore.com>
Fri, 23 May 2025 23:48:30 +0000 (17:48 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 24 Jun 2025 14:31:21 +0000 (08:31 -0600)
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.

gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S
gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S
gdb/testsuite/gdb.dwarf2/dw2-strp.S
gdb/testsuite/gdb.dwarf2/pr11465.S
gdb/testsuite/lib/dwarf.exp

index c09c6dbbc5d4d49a3f7c6c181159863ab2490c1b..06a93ac3086d451f76d649d792927c25f22e7924 100644 (file)
@@ -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:
index cd999f4f86ba7185b0bd1a2bbde86e6df6205f1a..551dda72da48fcccdbaae88b1d48ea52556284d2 100644 (file)
@@ -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:
index c7ede95293cee3e6c5e7cd42dcfc4fa0581861d0..db3e64fd3429b89563af11076c6ff36280565c90 100644 (file)
        .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:
index fed98bc121e6a60582e12d56340953ec2f1be11b..f3f2c57745fb091788bf42db82c6da13a5dde70f 100644 (file)
@@ -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:
index 4d224cdae75dae10e6ef869f0695c32ff194d720..3a182c22ea05c67955e4cac5a93b153a990953c9 100644 (file)
@@ -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\""