]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas/ELF: adjust bad section letter diagnostic
authorJan Beulich <jbeulich@suse.com>
Fri, 15 Aug 2025 10:18:51 +0000 (12:18 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 15 Aug 2025 10:18:51 +0000 (12:18 +0200)
Being told of a problem with .section when .pushsection was used can be
irritating, especially when several of them are on the same line.

gas/config/obj-elf.c
gas/testsuite/gas/elf/bad-section-flag.err
gas/testsuite/gas/elf/bad-section-flag.s

index 4e774dcd7d992d865577eb803bebadf59816f6b6..b39c59e54b8d3b7b4a5b6c8176fe4644acf7053a 100644 (file)
@@ -870,7 +870,7 @@ obj_elf_change_section (const char *name,
 }
 
 static bfd_vma
-obj_elf_parse_section_letters (char *str, size_t len,
+obj_elf_parse_section_letters (char *str, size_t len, bool push,
                               bool *is_clone, int *inherit, bfd_vma *gnu_attr)
 {
   bfd_vma attr = 0;
@@ -976,7 +976,8 @@ obj_elf_parse_section_letters (char *str, size_t len,
                *inherit = *str == '+' ? 1 : -1;
              else
                {
-                 as_bad (_("unrecognized .section attribute: want %s%s%s,? or number"),
+                 as_bad (_("unrecognized .%ssection attribute: want %s%s%s,? or number"),
+                   push ? "push" : "",
                    gnu_attr != NULL ? "a,d,e,o,w,x,G,M,R,S,T"
                                     : "a,e,o,w,x,G,M,S,T",
                    md_extra != NULL ? "," : "", md_extra);
@@ -1268,8 +1269,8 @@ obj_elf_section (int push)
            }
 
          const struct elf_backend_data *bed = get_elf_backend_data (stdoutput);
-         attr = obj_elf_parse_section_letters (beg, strlen (beg), &is_clone,
-                                               &inherit,
+         attr = obj_elf_parse_section_letters (beg, strlen (beg), push,
+                                               &is_clone, &inherit,
                                                bed->elf_osabi == ELFOSABI_NONE
                                                || (bed->elf_osabi
                                                    == ELFOSABI_GNU)
index 919d13f17cf0df67a0ffa42ca57d24a9cd998617..b3af9c15b6d22dd01f5b8f4bf6c5b2e91b581855 100644 (file)
@@ -1,2 +1,3 @@
 .*: Assembler messages:
 .*:1: Error: unrecognized [.]section attribute: .*
+.*:2: Error: unrecognized [.]pushsection attribute: .*
index 35496bd8e8b0e2408c6d9c99eb12a7560ba8ece8..7eaebaead39a43fd34ca4fd119ebf17c572b1792 100644 (file)
@@ -1 +1,2 @@
  .section ".rodata", "z~&q"
+ .pushsection ".rodata", "a!"