]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas/Dwarf: special-case .linefile only for macros
authorJan Beulich <jbeulich@suse.com>
Tue, 29 Mar 2022 06:18:14 +0000 (08:18 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 29 Mar 2022 06:18:14 +0000 (08:18 +0200)
Restrict the PR gas/16908 workaround to just macros, matching the
original intention as well as the comment there. For constructs like
.irp or .rept the reasoning doesn't apply, as there's no separate
"invocation" point which may be of interest to record (for, as said
there, short macros).

gas/macro.c
gas/testsuite/gas/elf/dwarf-5-irp.d
gas/testsuite/gas/elf/dwarf-5-irp.s

index 2228f5b5404fbb586380613c512c6073ca7e38b0..0d143dc50467c4805f40aac32ef7a8cdf8095291 100644 (file)
@@ -234,7 +234,8 @@ buffer_and_nest (const char *from, const char *to, sb *ptr,
             number when expanding the macro), and since for short
             macros we clearly prefer reporting the point of expansion
             anyway, there's not an obviously better fix here.  */
-         if (len >= 8 && strncasecmp (ptr->ptr + i, "linefile", 8) == 0)
+         if (from != NULL && strcasecmp (from, "MACRO") == 0
+             && len >= 8 && strncasecmp (ptr->ptr + i, "linefile", 8) == 0)
            {
              char saved_eol_char = ptr->ptr[ptr->len];
 
index c305c8dc2769d69ec61a7f7645d9eff38f75734d..d43a66057ff846f1b7b2b6098dcf0027d0ca14c0 100644 (file)
@@ -52,6 +52,22 @@ Raw dump of debug contents .*
 .*Advance PC by .*
 .*Extended opcode 1: End of Sequence
 
+.*Set File Name to entry 4 .*
+.*Extended opcode 2: .*
+.*Advance Line by 35 to 36
+.*Copy
+.*Special opcode .* and Line by 1 to 37
+.*Advance PC by .*
+.*Extended opcode 1: End of Sequence
+
+.*Set File Name to entry 4 .*
+.*Extended opcode 2: .*
+.*Advance Line by 35 to 36
+.*Copy
+.*Special opcode .* and Line by 1 to 37
+.*Advance PC by .*
+.*Extended opcode 1: End of Sequence
+
 
 Contents of the \.debug_aranges section:
 
@@ -66,6 +82,8 @@ Contents of the \.debug_aranges section:
     0+ [0-9a-f]+ ?
     0+ [0-9a-f]+ ?
     0+ [0-9a-f]+ ?
+    0+ [0-9a-f]+ ?
+    0+ [0-9a-f]+ ?
     0+ 0+ ?
 
 Contents of the \.debug_rnglists section:
@@ -75,6 +93,8 @@ Contents of the \.debug_rnglists section:
     [0-9a-f]+ 0+ [0-9a-f]+ ?
     [0-9a-f]+ 0+ [0-9a-f]+ ?
     [0-9a-f]+ 0+ [0-9a-f]+ ?
+    [0-9a-f]+ 0+ [0-9a-f]+ ?
+    [0-9a-f]+ 0+ [0-9a-f]+ ?
     [0-9a-f]+ <End of list>
 
 #pass
index e9e874699f69b19a6742cf17764dd4b2980b0922..b133cfd4fa96988fdc9d312981d57fe4b9cf5c5f 100644 (file)
@@ -29,3 +29,10 @@ _start:
        .nop
        n = n - 1
        .endr
+
+       .irp n, cd, nm
+# 35 "irp.s"
+       .section .text.\n, "ax"
+       .nop
+       .nop
+       .endr