Implement generic SHF_EXCLUDE.
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 18 May 2010 03:31:07 +0000 (03:31 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 18 May 2010 03:31:07 +0000 (03:31 +0000)
bfd/

2010-05-18  H.J. Lu  <hongjiu.lu@intel.com>

PR gas/11600
* elf.c (_bfd_elf_make_section_from_shdr): Handle SHF_EXCLUDE
(elf_fake_sections): Likewise.

* elf32-i370.c (i370_elf_section_from_shdr): Don't handle
SHF_EXCLUDE here.
* elf32-ppc.c (ppc_elf_fake_sections): Likewise.

binutils/

2010-05-18  H.J. Lu  <hongjiu.lu@intel.com>

PR gas/11600
* readelf.c (get_elf_section_flags): Treat SHF_EXCLUDE as a
generic flag.

binutils/testsuite/

2010-05-18  H.J. Lu  <hongjiu.lu@intel.com>

PR gas/11600
* binutils-all/objcopy.exp: Run exclude-1a and exclude-1b for
ELF targets.

* binutils-all/exclude-1.s: New.
* binutils-all/exclude-1a.d: Likewise.
* binutils-all/exclude-1b.d: Likewise.

gas/

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'.

gas/testsuite/

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.

include/elf/

2010-05-18  H.J. Lu  <hongjiu.lu@intel.com>

PR gas/11600
* common.h (SHF_EXCLUDE): New.

* i370.h (SHF_EXCLUDE): Removed.
* or32.h (SHF_EXCLUDE): Likewise.
* ppc.h (SHF_EXCLUDE): Likewise.
* sparc.h (SHF_EXCLUDE): Likewise.

ld/testsuite/

2010-05-18  H.J. Lu  <hongjiu.lu@intel.com>

PR gas/11600
* ld-elf/exclude3.s: New.
* ld-elf/exclude3a.d: Likewise.
* ld-elf/exclude3b.d: Likewise.
* ld-elf/exclude3c.d: Likewise.

31 files changed:
bfd/ChangeLog
bfd/elf.c
bfd/elf32-i370.c
bfd/elf32-ppc.c
binutils/ChangeLog
binutils/readelf.c
binutils/testsuite/ChangeLog
binutils/testsuite/binutils-all/exclude-1.s [new file with mode: 0644]
binutils/testsuite/binutils-all/exclude-1a.d [new file with mode: 0644]
binutils/testsuite/binutils-all/exclude-1b.d [new file with mode: 0644]
binutils/testsuite/binutils-all/objcopy.exp
gas/ChangeLog
gas/config/obj-elf.c
gas/config/tc-ppc.c
gas/config/tc-ppc.h
gas/doc/as.texinfo
gas/testsuite/ChangeLog
gas/testsuite/gas/elf/elf.exp
gas/testsuite/gas/elf/section8.d [new file with mode: 0644]
gas/testsuite/gas/elf/section8.s [new file with mode: 0644]
include/elf/ChangeLog
include/elf/common.h
include/elf/i370.h
include/elf/or32.h
include/elf/ppc.h
include/elf/sparc.h
ld/testsuite/ChangeLog
ld/testsuite/ld-elf/exclude3.s [new file with mode: 0644]
ld/testsuite/ld-elf/exclude3a.d [new file with mode: 0644]
ld/testsuite/ld-elf/exclude3b.d [new file with mode: 0644]
ld/testsuite/ld-elf/exclude3c.d [new file with mode: 0644]

index f5dc25e3f2b0574fb1b01b6ab6d1a4e5014176b5..8c3eb13ca7161ddd93109f9d5cf3b2b1310156a4 100644 (file)
@@ -1,3 +1,13 @@
+2010-05-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/11600
+       * elf.c (_bfd_elf_make_section_from_shdr): Handle SHF_EXCLUDE
+       (elf_fake_sections): Likewise.
+
+       * elf32-i370.c (i370_elf_section_from_shdr): Don't handle
+       SHF_EXCLUDE here.
+       * elf32-ppc.c (ppc_elf_fake_sections): Likewise.
+
 2010-05-17  Tristan Gingold  <gingold@adacore.com>
 
        * vms-alpha.c: Include esgps.h and eidc.h.
index a5a24c52997684b1ec8a000cd89f56e5856b7dc0..0fa75d255c01b9c5db00ebd6c2a7bf64eaa6a1b3 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -876,6 +876,8 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
       return FALSE;
   if ((hdr->sh_flags & SHF_TLS) != 0)
     flags |= SEC_THREAD_LOCAL;
+  if ((hdr->sh_flags & SHF_EXCLUDE) != 0)
+    flags |= SEC_EXCLUDE;
 
   if ((flags & SEC_ALLOC) == 0)
     {
@@ -2627,6 +2629,8 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
            }
        }
     }
+  if ((asect->flags & (SEC_GROUP | SEC_EXCLUDE)) == SEC_EXCLUDE)
+    this_hdr->sh_flags |= SHF_EXCLUDE;
 
   /* Check for processor-specific section types.  */
   sh_type = this_hdr->sh_type;
index c419edd605ff371beb274c5fe6422d568ed25fa1..ff0208ee3e334b48cf15f6d4a6692ec4ed5e6243 100644 (file)
@@ -375,9 +375,6 @@ i370_elf_section_from_shdr (bfd *abfd,
 
   newsect = hdr->bfd_section;
   flags = bfd_get_section_flags (abfd, newsect);
-  if (hdr->sh_flags & SHF_EXCLUDE)
-    flags |= SEC_EXCLUDE;
-
   if (hdr->sh_type == SHT_ORDERED)
     flags |= SEC_SORT_ENTRIES;
 
index 28274c40437bb031332426dc80123accc1ae51aa..1580599fe114e0327b8556442bea4a1f73776dc3 100644 (file)
@@ -1994,9 +1994,6 @@ ppc_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
                       Elf_Internal_Shdr *shdr,
                       asection *asect)
 {
-  if ((asect->flags & (SEC_GROUP | SEC_EXCLUDE)) == SEC_EXCLUDE)
-    shdr->sh_flags |= SHF_EXCLUDE;
-
   if ((asect->flags & SEC_SORT_ENTRIES) != 0)
     shdr->sh_type = SHT_ORDERED;
 
index 964e4835e72ae264da21c3457d53b878c3154b36..9c8d87cecf939480117864ec9a8e763f572dc42a 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/11600
+       * readelf.c (get_elf_section_flags): Treat SHF_EXCLUDE as a
+       generic flag.
+
 2010-05-07  Tristan Gingold  <gingold@adacore.com>
 
        * Makefile.in: Regenerate with automake 1.11.1.
index 53699b26cf95c6c2b8b269fa592a6aea80074aeb..bcb24c2d00c4a3c1c0b3eeebcb0b5928e5c53780 100644 (file)
@@ -4152,8 +4152,9 @@ get_elf_section_flags (bfd_vma sh_flags)
       /* 15 */ { STRING_COMMA_LEN ("VMS_VECTOR") },
       /* 16 */ { STRING_COMMA_LEN ("VMS_ALLOC_64BIT") },
       /* 17 */ { STRING_COMMA_LEN ("VMS_PROTECTED") },
-      /* SPARC specific.  */
+      /* Generic.  */
       /* 18 */ { STRING_COMMA_LEN ("EXCLUDE") },
+      /* SPARC specific.  */
       /* 19 */ { STRING_COMMA_LEN ("ORDERED") }
     };
 
@@ -4185,6 +4186,7 @@ get_elf_section_flags (bfd_vma sh_flags)
            case SHF_OS_NONCONFORMING:  sindex = 7; break;
            case SHF_GROUP:             sindex = 8; break;
            case SHF_TLS:               sindex = 9; break;
+           case SHF_EXCLUDE:           sindex = 18; break;
 
            default:
              sindex = -1;
@@ -4218,9 +4220,7 @@ get_elf_section_flags (bfd_vma sh_flags)
                case EM_SPARC32PLUS:
                case EM_SPARCV9:
                case EM_SPARC:
-                 if (flag == SHF_EXCLUDE)
-                   sindex = 18;
-                 else if (flag == SHF_ORDERED)
+                 if (flag == SHF_ORDERED)
                    sindex = 19;
                  break;
                default:
@@ -4263,6 +4263,7 @@ get_elf_section_flags (bfd_vma sh_flags)
            case SHF_OS_NONCONFORMING:  *p = 'O'; break;
            case SHF_GROUP:             *p = 'G'; break;
            case SHF_TLS:               *p = 'T'; break;
+           case SHF_EXCLUDE:           *p = 'E'; break;
 
            default:
              if ((elf_header.e_machine == EM_X86_64
index 3b08cda7e567871ca13804d7bd493ab1a9437284..1f4d19bfd577b76817378dc9b20613f9ae5dd920 100644 (file)
@@ -1,3 +1,13 @@
+2010-05-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/11600
+       * binutils-all/objcopy.exp: Run exclude-1a and exclude-1b for
+       ELF targets.
+
+       * binutils-all/exclude-1.s: New.
+       * binutils-all/exclude-1a.d: Likewise.
+       * binutils-all/exclude-1b.d: Likewise.
+
 2010-04-30  H.J. Lu  <hongjiu.lu@intel.com>
 
        * binutils-all/dlltool.exp: Add a missing `"'.
diff --git a/binutils/testsuite/binutils-all/exclude-1.s b/binutils/testsuite/binutils-all/exclude-1.s
new file mode 100644 (file)
index 0000000..475088f
--- /dev/null
@@ -0,0 +1,16 @@
+       .text
+       .type start,"function"
+       .global start
+start:
+       .type _start,"function"
+       .global _start
+_start:
+       .type __start,"function"
+       .global __start
+__start:
+       .type main,"function"
+       .global main
+main:
+       .long 0
+       .section .foo1,"e", %progbits
+       .byte 0,0,0,0
diff --git a/binutils/testsuite/binutils-all/exclude-1a.d b/binutils/testsuite/binutils-all/exclude-1a.d
new file mode 100644 (file)
index 0000000..3a311b5
--- /dev/null
@@ -0,0 +1,9 @@
+#PROG: objcopy
+#source: exclude-1.s
+#objcopy:
+#readelf: -S --wide
+#name: objcopy on sections with SHF_EXCLUDE
+
+#...
+[      ]*\[.*\][       ]+\.foo1[       ]+PROGBITS.*[   ]+E[   ]+.*
+#pass
diff --git a/binutils/testsuite/binutils-all/exclude-1b.d b/binutils/testsuite/binutils-all/exclude-1b.d
new file mode 100644 (file)
index 0000000..ac387fb
--- /dev/null
@@ -0,0 +1,9 @@
+#PROG: strip
+#source: exclude-1.s
+#strip: --strip-unneeded
+#readelf: -S --wide
+#name: strip --strip-unneeded on sections with SHF_EXCLUDE
+
+#...
+[      ]*\[.*\][       ]+\.foo1[       ]+PROGBITS.*[   ]+E[   ]+.*
+#pass
index 5c7de8c80a0733ce205e188abeb6adb158743e51..94a31aa357181e3f25625c7b0098565134a939ef 100644 (file)
@@ -880,5 +880,8 @@ if [is_elf_format] {
 
     run_dump_test "add-section"
     run_dump_test "add-empty-section"
+
+    run_dump_test "exclude-1a"
+    run_dump_test "exclude-1b"
 }
 run_dump_test "localize-hidden-2"
index d6dd29216e54701c1c21d12d63a90cce33662eb0..13f1a2e780783439be1b3881e278ebc39ee3ae46 100644 (file)
@@ -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
index 4bd4514d1407954e7fb11afb09d0c0e513de3908..3ffe6e9dd16dfa0b7c3f9a37c302d391c6343191 100644 (file)
@@ -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;
 
index 5b5be0a72cbf442b2fb3ded8aca3447ff9993537..4f604a1bae6f3a3d4612fd1168b69c1634e08575 100644 (file)
@@ -3089,26 +3089,7 @@ ppc_macro (char *str, const struct powerpc_macro *macro)
 }
 \f
 #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 */
index be474bde59f5ffb406b82b46e130a0c277850b6b..08f0aeef3387bef48f939b6143ddbb5988ce0537 100644 (file)
@@ -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
index 531c157be8570dc273b400609d3ed14dbfeaa759..418e133dcbf9b8ec42a66814fad28aaad84e8c58 100644 (file)
@@ -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
index 628239d35a1c77ebaa0d93e7a8db997e6276cd5f..59f98302d74da3836294a9bdb1c3edfedcfbacdf 100644 (file)
@@ -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.
index 05b5a4b98f1539fb72357d4267b61cf8cf9e98d4..7c191adc32fb6cdadd169b786c41670edae83ecc 100644 (file)
@@ -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 (file)
index 0000000..0400745
--- /dev/null
@@ -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 (file)
index 0000000..96cb7a8
--- /dev/null
@@ -0,0 +1,2 @@
+       .section .foo1,"e", %progbits
+       .byte 0,0,0,0
index b65c881d25f044551b3a14697467861cff50f045..9008aaabe313494067a5aba05bf54b9d92d2fca9 100644 (file)
@@ -1,3 +1,13 @@
+2010-05-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/11600
+       * common.h (SHF_EXCLUDE): New.
+
+       * i370.h (SHF_EXCLUDE): Removed.
+       * or32.h (SHF_EXCLUDE): Likewise.
+       * ppc.h (SHF_EXCLUDE): Likewise.
+       * sparc.h (SHF_EXCLUDE): Likewise.
+
 2010-04-23  Alan Modra  <amodra@gmail.com>
 
        * internal.h (ELF_SECTION_SIZE): Protect macro args with parentheses.
index b2a6c73f0fc13f379a596511987ce5c610706aef..01c519dd0d4a38a4f48973eb5950255a2b45b39b 100644 (file)
 #define SHF_MASKOS     0x0FF00000      /* New value, Oct 4, 1999 Draft */
 #define SHF_MASKPROC   0xF0000000      /* Processor-specific semantics */
 
+/* This used to be implemented as a processor specific section flag.
+   We just make it generic.  */
+#define SHF_EXCLUDE    0x80000000      /* Link editor is to exclude
+                                          this section from executable
+                                          and shared library that it
+                                          builds when those objects
+                                          are not to be further
+                                          relocated.  */
+
 /* Values of note segment descriptor types for core files.  */
 
 #define NT_PRSTATUS    1               /* Contains copy of prstatus struct */
index 6229aab524e8f7bf13c04f85a6d07677dadfcacb..7b451ff9db212a51231935b004fe57c93003abe3 100644 (file)
 
 #define        EF_I370_RELOCATABLE     0x00010000      /* i370 -mrelocatable flag */
 #define        EF_I370_RELOCATABLE_LIB 0x00008000      /* i370 -mrelocatable-lib flag */
-/* Processor specific section flags, sh_flags field */
-
-#define SHF_EXCLUDE            0x80000000      /* Link editor is to exclude \
-                                                  this section from executable \
-                                                  and shared objects that it \
-                                                  builds when those objects \
-                                                  are not to be furhter \
-                                                  relocated.  */
 
 /* i370 relocations
    Note that there is really just one relocation that we currently
index 256696bb4687e86f2d55e0514884751091374b82..9f1c2f3f7e555685b72f06d42f6b9823e69c0b1e 100644 (file)
@@ -53,11 +53,4 @@ END_RELOC_NUMBERS (R_OR32_max)
                                                   specified in the associated \
                                                   symbol table entry.  */
 
-/* Processor specific section flags, sh_flags field */
-#define SHF_EXCLUDE            0x80000000      /* Link editor is to exclude \
-                                                  this section from executable \
-                                                  and shared objects that it \
-                                                  builds when those objects \
-                                                  are not to be furhter \
-                                                  relocated.  */
 #endif /* _ELF_OR1K_H */
index 230870dd45dc51ae434c71f8d1b2abdeb0cff003..688cb9b9d198de6299994287744dd841a30a813e 100644 (file)
@@ -174,15 +174,6 @@ END_RELOC_NUMBERS (R_PPC_max)
                                                   specified in the associated \
                                                   symbol table entry.  */
 
-/* Processor specific section flags, sh_flags field.  */
-
-#define SHF_EXCLUDE            0x80000000      /* Link editor is to exclude \
-                                                  this section from executable \
-                                                  and shared objects that it \
-                                                  builds when those objects \
-                                                  are not to be furhter \
-                                                  relocated.  */
-
 /* Object attribute tags.  */
 enum
 {
index 762f3b555ec072ae0bfd763c6045ba6025e4519b..4247151340fd82040a0fe96a62aa72c8d8ad74e4 100644 (file)
@@ -51,7 +51,6 @@
 
 /* Section flags.  */
 
-#define SHF_EXCLUDE            0x80000000      /* exclude from linking */
 #define SHF_ORDERED            0x40000000      /* treat sh_link,sh_info specially */
 
 /* Symbol types.  */
index bafd3bb531a48c681b7777b137aaa3f46cdfbc7f..61daf448410c193d57b68e02184e66c193880f72 100644 (file)
@@ -1,3 +1,11 @@
+2010-05-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/11600
+       * ld-elf/exclude3.s: New.
+       * ld-elf/exclude3a.d: Likewise.
+       * ld-elf/exclude3b.d: Likewise.
+       * ld-elf/exclude3c.d: Likewise.
+
 2010-05-11  Andrew Stubbs  <ams@codesourcery.com>
 
        * ld-arm/attr-merge-2.attr: Add Tag_DIV_use.
diff --git a/ld/testsuite/ld-elf/exclude3.s b/ld/testsuite/ld-elf/exclude3.s
new file mode 100644 (file)
index 0000000..475088f
--- /dev/null
@@ -0,0 +1,16 @@
+       .text
+       .type start,"function"
+       .global start
+start:
+       .type _start,"function"
+       .global _start
+_start:
+       .type __start,"function"
+       .global __start
+__start:
+       .type main,"function"
+       .global main
+main:
+       .long 0
+       .section .foo1,"e", %progbits
+       .byte 0,0,0,0
diff --git a/ld/testsuite/ld-elf/exclude3a.d b/ld/testsuite/ld-elf/exclude3a.d
new file mode 100644 (file)
index 0000000..7343e45
--- /dev/null
@@ -0,0 +1,10 @@
+#source: exclude3.s
+#ld:
+#readelf: -S --wide
+#target: x86_64-*-* i?86-*-* ia64-*-*
+
+#...
+[      ]*\[.*\][       ]+NULL.*
+[      ]*\[.*\][       ]+\.text[       ]+PROGBITS.*
+[      ]*\[.*\][       ]+.*STRTAB.*
+#pass
diff --git a/ld/testsuite/ld-elf/exclude3b.d b/ld/testsuite/ld-elf/exclude3b.d
new file mode 100644 (file)
index 0000000..f640449
--- /dev/null
@@ -0,0 +1,9 @@
+#source: exclude3.s
+#ld: --shared
+#readelf: -S --wide
+#target: x86_64-*-* i?86-*-* ia64-*-*
+
+#...
+[      ]*\[.*\][       ]+\.got.*[      ]+PROGBITS.*
+[      ]*\[.*\][       ]+.*STRTAB.*
+#pass
diff --git a/ld/testsuite/ld-elf/exclude3c.d b/ld/testsuite/ld-elf/exclude3c.d
new file mode 100644 (file)
index 0000000..57311c8
--- /dev/null
@@ -0,0 +1,7 @@
+#source: exclude3.s
+#ld: -r
+#readelf: -S --wide
+
+#...
+[      ]*\[.*\][       ]+\.foo1[       ]+PROGBITS.*[   ]+E[   ]+.*
+#pass