From 503687d7b0da22b849a991dd19a86ebbe3b8ec3c Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 16 Sep 2010 23:55:08 +0000 Subject: [PATCH] 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/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. --- gas/ChangeLog | 10 ++++++++++ gas/config/obj-elf.c | 2 +- gas/config/tc-alpha.c | 2 +- gas/config/tc-i386.c | 4 ++-- gas/config/tc-ia64.c | 2 +- gas/config/tc-mep.c | 4 ++-- gas/testsuite/ChangeLog | 7 +++++++ gas/testsuite/gas/elf/bad-section-flag.d | 2 ++ gas/testsuite/gas/elf/bad-section-flag.err | 2 ++ gas/testsuite/gas/elf/bad-section-flag.s | 1 + gas/testsuite/gas/elf/elf.exp | 1 + 11 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 gas/testsuite/gas/elf/bad-section-flag.d create mode 100644 gas/testsuite/gas/elf/bad-section-flag.err create mode 100644 gas/testsuite/gas/elf/bad-section-flag.s diff --git a/gas/ChangeLog b/gas/ChangeLog index f230efc35..f8fb4f456 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,13 @@ +2010-09-17 Andrew Burgess + + 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. + 2010-09-15 Kai Tietz * config/obj-coff-seh.c (seh_validate_seg): New funtion. diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index e9ae4ea9e..43820f51e 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -794,7 +794,7 @@ obj_elf_parse_section_letters (char *str, size_t len, bfd_boolean *clone) 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 diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c index 3cfca209a..bd0a44f69 100644 --- a/gas/config/tc-alpha.c +++ b/gas/config/tc-alpha.c @@ -5364,7 +5364,7 @@ alpha_elf_section_letter (int letter, char **ptr_msg) 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; } diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index ee3470e48..cc08efb97 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -8949,10 +8949,10 @@ x86_64_section_letter (int letter, char **ptr_msg) 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; } diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index 73e31aaff..95f953fa2 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -861,7 +861,7 @@ ia64_elf_section_letter (int letter, char **ptr_msg) 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; } diff --git a/gas/config/tc-mep.c b/gas/config/tc-mep.c index ae2463e01..3a6bd6a7d 100644 --- a/gas/config/tc-mep.c +++ b/gas/config/tc-mep.c @@ -2086,8 +2086,8 @@ mep_elf_section_letter (int letter, char **ptrmsg) 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 diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 976dff4cf..2bd1becf4 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2010-09-17 Andrew Burgess + + 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. + 2010-09-16 Alan Modra * gas/all/redef3.d: Don't run on arc. diff --git a/gas/testsuite/gas/elf/bad-section-flag.d b/gas/testsuite/gas/elf/bad-section-flag.d new file mode 100644 index 000000000..98cbac8dd --- /dev/null +++ b/gas/testsuite/gas/elf/bad-section-flag.d @@ -0,0 +1,2 @@ +#name: Check bad section flag +#error-output: bad-section-flag.err diff --git a/gas/testsuite/gas/elf/bad-section-flag.err b/gas/testsuite/gas/elf/bad-section-flag.err new file mode 100644 index 000000000..0af9b693b --- /dev/null +++ b/gas/testsuite/gas/elf/bad-section-flag.err @@ -0,0 +1,2 @@ +.*bad-section-flag\.s: Assembler messages: +.*bad-section-flag\.s:1: Fatal error: .* diff --git a/gas/testsuite/gas/elf/bad-section-flag.s b/gas/testsuite/gas/elf/bad-section-flag.s new file mode 100644 index 000000000..35496bd8e --- /dev/null +++ b/gas/testsuite/gas/elf/bad-section-flag.s @@ -0,0 +1 @@ + .section ".rodata", "z~&q" diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp index 04f274986..e6f5f0573 100644 --- a/gas/testsuite/gas/elf/elf.exp +++ b/gas/testsuite/gas/elf/elf.exp @@ -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" } -- 2.11.4.GIT