This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PR gas/12011, invalid ELF section flags
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Cc: Andrew Burgess <aburgess at broadcom dot com>
- Date: Fri, 17 Sep 2010 09:44:32 +0930
- Subject: PR gas/12011, invalid ELF section flags
Applied.
gas/
PR gas/12011
* config/obj-elf.c (obj_elf_parse_section_letters): Correct test
for error return from md_elf_section_letter.
* config/tc-alpha.c (alpha_elf_section_letter): Correct error message.
* config/tc-i386.c (x86_64_section_letter): Likewise.
* config/tc-ia64.c (ia64_elf_section_letter): Likewise.
* config/tc-mep.c (mep_elf_section_letter): Likewise.
gas/testsuite/
PR gas/12011
* gas/elf/bad-section-flag.d, * gas/elf/bad-section-flag.err,
* gas/elf/bad-section-flag.s: New test.
* gas/elf/elf.exp: Run it.
Index: gas/config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.130
diff -u -p -r1.130 obj-elf.c
--- gas/config/obj-elf.c 31 Aug 2010 05:34:46 -0000 1.130
+++ gas/config/obj-elf.c 16 Sep 2010 23:35:01 -0000
@@ -794,7 +794,7 @@ obj_elf_parse_section_letters (char *str
char *bad_msg = _("unrecognized .section attribute: want a,e,w,x,M,S,G,T");
#ifdef md_elf_section_letter
bfd_vma md_attr = md_elf_section_letter (*str, &bad_msg);
- if (md_attr > 0)
+ if (md_attr != (bfd_vma) -1)
attr |= md_attr;
else
#endif
Index: gas/config/tc-alpha.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-alpha.c,v
retrieving revision 1.87
diff -u -p -r1.87 tc-alpha.c
--- gas/config/tc-alpha.c 28 Jun 2010 14:06:56 -0000 1.87
+++ gas/config/tc-alpha.c 16 Sep 2010 23:35:03 -0000
@@ -5364,7 +5364,7 @@ alpha_elf_section_letter (int letter, ch
if (letter == 's')
return SHF_ALPHA_GPREL;
- *ptr_msg = _("Bad .section directive: want a,s,w,x,M,S,G,T in string");
+ *ptr_msg = _("bad .section directive: want a,s,w,x,M,S,G,T in string");
return -1;
}
Index: gas/config/tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.449
diff -u -p -r1.449 tc-i386.c
--- gas/config/tc-i386.c 9 Sep 2010 21:12:37 -0000 1.449
+++ gas/config/tc-i386.c 16 Sep 2010 23:35:05 -0000
@@ -8949,10 +8949,10 @@ x86_64_section_letter (int letter, char
if (letter == 'l')
return SHF_X86_64_LARGE;
- *ptr_msg = _("Bad .section directive: want a,l,w,x,M,S,G,T in string");
+ *ptr_msg = _("bad .section directive: want a,l,w,x,M,S,G,T in string");
}
else
- *ptr_msg = _("Bad .section directive: want a,w,x,M,S,G,T in string");
+ *ptr_msg = _("bad .section directive: want a,w,x,M,S,G,T in string");
return -1;
}
Index: gas/config/tc-ia64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.c,v
retrieving revision 1.213
diff -u -p -r1.213 tc-ia64.c
--- gas/config/tc-ia64.c 12 Feb 2010 14:34:45 -0000 1.213
+++ gas/config/tc-ia64.c 16 Sep 2010 23:35:07 -0000
@@ -861,7 +861,7 @@ ia64_elf_section_letter (int letter, cha
return SHF_IA_64_VMS_GLOBAL;
#endif
- *ptr_msg = _("Bad .section directive: want a,o,s,w,x,M,S,G,T in string");
+ *ptr_msg = _("bad .section directive: want a,o,s,w,x,M,S,G,T in string");
return -1;
}
Index: gas/config/tc-mep.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mep.c,v
retrieving revision 1.15
diff -u -p -r1.15 tc-mep.c
--- gas/config/tc-mep.c 29 Oct 2009 09:43:18 -0000 1.15
+++ gas/config/tc-mep.c 16 Sep 2010 23:35:08 -0000
@@ -2086,8 +2086,8 @@ mep_elf_section_letter (int letter, char
if (letter == 'v')
return SHF_MEP_VLIW;
- *ptrmsg = _("Bad .section directive: want a,v,w,x,M,S in string");
- return 0;
+ *ptrmsg = _("bad .section directive: want a,v,w,x,M,S in string");
+ return -1;
}
flagword
Index: gas/testsuite/gas/elf/bad-section-flag.d
===================================================================
RCS file: gas/testsuite/gas/elf/bad-section-flag.d
diff -N gas/testsuite/gas/elf/bad-section-flag.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/elf/bad-section-flag.d 16 Sep 2010 23:40:18 -0000
@@ -0,0 +1,2 @@
+#name: Check bad section flag
+#error-output: bad-section-flag.err
Index: gas/testsuite/gas/elf/bad-section-flag.err
===================================================================
RCS file: gas/testsuite/gas/elf/bad-section-flag.err
diff -N gas/testsuite/gas/elf/bad-section-flag.err
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/elf/bad-section-flag.err 16 Sep 2010 23:40:18 -0000
@@ -0,0 +1,2 @@
+.*bad-section-flag\.s: Assembler messages:
+.*bad-section-flag\.s:1: Fatal error: .*
Index: gas/testsuite/gas/elf/bad-section-flag.s
===================================================================
RCS file: gas/testsuite/gas/elf/bad-section-flag.s
diff -N gas/testsuite/gas/elf/bad-section-flag.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/elf/bad-section-flag.s 16 Sep 2010 23:40:18 -0000
@@ -0,0 +1 @@
+ .section ".rodata", "z~&q"
Index: gas/testsuite/gas/elf/elf.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/elf/elf.exp,v
retrieving revision 1.65
diff -u -p -r1.65 elf.exp
--- gas/testsuite/gas/elf/elf.exp 17 Aug 2010 20:03:41 -0000 1.65
+++ gas/testsuite/gas/elf/elf.exp 16 Sep 2010 23:40:18 -0000
@@ -167,4 +167,5 @@ if { ([istarget "*-*-*elf*"]
run_dump_test "dwarf2-1"
run_dump_test "dwarf2-2"
run_dump_test "dwarf2-3"
+ run_dump_test "bad-section-flag"
}
--
Alan Modra
Australia Development Lab, IBM