public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Cc: Andrew Burgess <aburgess@broadcom.com>
Subject: PR gas/12011, invalid ELF section flags
Date: Fri, 17 Sep 2010 00:14:00 -0000	[thread overview]
Message-ID: <20100917001432.GA16874@bubble.grove.modra.org> (raw)

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

                 reply	other threads:[~2010-09-17  0:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100917001432.GA16874@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=aburgess@broadcom.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).