diff options
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 16 | ||||
-rw-r--r-- | gas/config/obj-elf.c | 8 | ||||
-rw-r--r-- | gas/config/tc-ppc.c | 24 | ||||
-rw-r--r-- | gas/config/tc-ppc.h | 6 | ||||
-rw-r--r-- | gas/doc/as.texinfo | 4 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/elf.exp | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/section8.d | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/section8.s | 2 |
9 files changed, 46 insertions, 29 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index d6dd292..13f1a2e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,19 @@ +2010-05-18 H.J. Lu <hongjiu.lu@intel.com> + + PR gas/11600 + * obj-elf.c (obj_elf_change_section): Handle SHF_EXCLUDE. + (obj_elf_parse_section_letters): Likewise. + (obj_elf_section_word): Likewise. + + * config/tc-ppc.c (ppc_section_letter): Removed. + (ppc_section_word): Likewise. + * config/tc-ppc.h (ppc_section_letter): Likewise. + (ppc_section_word): Likewise. + (md_elf_section_letter): Likewise. + (md_elf_section_word): Likewise. + + * doc/as.texinfo: Document `e' and `#exclude'. + 2010-05-13 Nathan Sidwell <nathan@codesourcery.com> * config/tc-arm.c (md_assemble): Clarify current mode in error diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 4bd4514..3ffe6e9 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -673,6 +673,7 @@ obj_elf_change_section (const char *name, | ((attr & SHF_EXECINSTR) ? SEC_CODE : 0) | ((attr & SHF_MERGE) ? SEC_MERGE : 0) | ((attr & SHF_STRINGS) ? SEC_STRINGS : 0) + | ((attr & SHF_EXCLUDE) ? SEC_EXCLUDE: 0) | ((attr & SHF_TLS) ? SEC_THREAD_LOCAL : 0)); #ifdef md_elf_section_flags flags = md_elf_section_flags (flags, attr, type); @@ -745,6 +746,9 @@ obj_elf_parse_section_letters (char *str, size_t len) case 'a': attr |= SHF_ALLOC; break; + case 'e': + attr |= SHF_EXCLUDE; + break; case 'w': attr |= SHF_WRITE; break; @@ -777,7 +781,7 @@ obj_elf_parse_section_letters (char *str, size_t len) } default: { - char *bad_msg = _("unrecognized .section attribute: want a,w,x,M,S,G,T"); + 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) @@ -834,6 +838,8 @@ obj_elf_section_word (char *str, size_t len, int *type) return SHF_ALLOC; if (len == 9 && strncmp (str, "execinstr", 9) == 0) return SHF_EXECINSTR; + if (len == 7 && strncmp (str, "exclude", 7) == 0) + return SHF_EXCLUDE; if (len == 3 && strncmp (str, "tls", 3) == 0) return SHF_TLS; diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 5b5be0a..4f604a1 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -3089,26 +3089,7 @@ ppc_macro (char *str, const struct powerpc_macro *macro) } #ifdef OBJ_ELF -/* For ELF, add support for SHF_EXCLUDE and SHT_ORDERED. */ - -bfd_vma -ppc_section_letter (int letter, char **ptr_msg) -{ - if (letter == 'e') - return SHF_EXCLUDE; - - *ptr_msg = _("Bad .section directive: want a,e,w,x,M,S,G,T in string"); - return -1; -} - -bfd_vma -ppc_section_word (char *str, size_t len) -{ - if (len == 7 && strncmp (str, "exclude", 7) == 0) - return SHF_EXCLUDE; - - return -1; -} +/* For ELF, add support for SHT_ORDERED. */ int ppc_section_type (char *str, size_t len) @@ -3125,9 +3106,6 @@ ppc_section_flags (flagword flags, bfd_vma attr, int type) if (type == SHT_ORDERED) flags |= SEC_ALLOC | SEC_LOAD | SEC_SORT_ENTRIES; - if (attr & SHF_EXCLUDE) - flags |= SEC_EXCLUDE; - return flags; } #endif /* OBJ_ELF */ diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h index be474bd..08f0aee 100644 --- a/gas/config/tc-ppc.h +++ b/gas/config/tc-ppc.h @@ -206,15 +206,11 @@ extern const char ppc_symbol_chars[]; #ifdef OBJ_ELF -/* Support for SHF_EXCLUDE and SHT_ORDERED */ -extern bfd_vma ppc_section_letter (int, char **); +/* Support for SHT_ORDERED */ extern int ppc_section_type (char *, size_t); -extern bfd_vma ppc_section_word (char *, size_t); extern int ppc_section_flags (flagword, bfd_vma, int); -#define md_elf_section_letter(LETTER, PTR_MSG) ppc_section_letter (LETTER, PTR_MSG) #define md_elf_section_type(STR, LEN) ppc_section_type (STR, LEN) -#define md_elf_section_word(STR, LEN) ppc_section_word (STR, LEN) #define md_elf_section_flags(FLAGS, ATTR, TYPE) ppc_section_flags (FLAGS, ATTR, TYPE) #define tc_comment_chars ppc_comment_chars diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index 531c157..418e133 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -5874,6 +5874,8 @@ combination of the following characters: @table @code @item a section is allocatable +@item e +section is excluded from executable and shared library. @item w section is writable @item x @@ -5971,6 +5973,8 @@ section is allocatable section is writable @item #execinstr section is executable +@item #exclude +section is excluded from executable and shared library. @item #tls section is used for thread local storage @end table diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 628239d..59f9830 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2010-05-18 H.J. Lu <hongjiu.lu@intel.com> + + PR gas/11600 + * gas/elf/elf.exp: Run section8. + + * gas/elf/section8.d: New. + * gas/elf/section8.s: Likewise. + 2010-05-13 Nathan Sidwell <nathan@codesourcery.com> * gas/arm/armv1-bad.l: Adjust expected error text. diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp index 05b5a4b..7c191ad 100644 --- a/gas/testsuite/gas/elf/elf.exp +++ b/gas/testsuite/gas/elf/elf.exp @@ -157,4 +157,5 @@ if { ([istarget "*-*-*elf*"] run_dump_test "section6" run_dump_test "section7" + run_dump_test "section8" } diff --git a/gas/testsuite/gas/elf/section8.d b/gas/testsuite/gas/elf/section8.d new file mode 100644 index 0000000..0400745 --- /dev/null +++ b/gas/testsuite/gas/elf/section8.d @@ -0,0 +1,6 @@ +#readelf: -S --wide +#name: section flags + +#... +[ ]*\[.*\][ ]+\.foo1[ ]+PROGBITS.*[ ]+E[ ]+.* +#pass diff --git a/gas/testsuite/gas/elf/section8.s b/gas/testsuite/gas/elf/section8.s new file mode 100644 index 0000000..96cb7a8 --- /dev/null +++ b/gas/testsuite/gas/elf/section8.s @@ -0,0 +1,2 @@ + .section .foo1,"e", %progbits + .byte 0,0,0,0 |