From 8f3bae45202d47cc88273b0060a458841cd46282 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 16 Sep 2010 23:55:10 +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 f230efc3500..f8fb4f45685 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 e9ae4ea9e94..43820f51e00 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 3cfca209ade..bd0a44f6980 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 ee3470e48a2..cc08efb97df 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 73e31aaffdc..95f953fa2af 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 ae2463e0198..3a6bd6a7d46 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 976dff4cf34..2bd1becf4ab 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 00000000000..98cbac8dd3c --- /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 00000000000..0af9b693bab --- /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 00000000000..35496bd8e8b --- /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 04f2749865a..e6f5f05733a 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.30.2