2010-10-23 Mark Mitchell <mark@codesourcery.com>
authorMark Mitchell <mark@codesourcery.com>
Sat, 23 Oct 2010 18:05:10 +0000 (18:05 +0000)
committerMark Mitchell <mark@codesourcery.com>
Sat, 23 Oct 2010 18:05:10 +0000 (18:05 +0000)
* config/obj-elf.c (elf_adjust_symtab): New.  Move group section
processing here from elf_frob_file.  Ensure that group signature
symbols have the name of the group.
(elf_frob_file): Move group section processing to
elf_adjust_symtab.
* config/obj-elf.h (elf_adjust_symtab): Declare.
(obj_adjust_symtab): Define.
* config/tc-arm.c (arm_adjust_symtab): Call elf_adjust_symtab.

2010-10-23  Mark Mitchell  <mark@codesourcery.com>

* gas/elf/elf.exp: Add group0c test.
* gas/elf/group0c.d: New.
* gas/elf/group0a.d: Expect ".group" for the name of group
sections.
* gas/elf/group0b.d: Likewise.
* gas/elf/group1a.d: Likewise.
* gas/elf/group1b.d: Likewise.
* gas/elf/groupautoa.d: Likewise.
* gas/elf/groupautob.d: Likewise.
* gas/elf/section4.d: Likewise.
* gas/ia64/group-1.d: Likewise.  Adjust hard-coded constants.

2010-10-22  Mark Mitchell  <mark@codesourcery.com>

* binutils-all/group-5.d: Expect ".group" for the name of group
sections.
* binutils-all/strip-2.d: Likewise.

2010-10-23  Mark Mitchell  <mark@codesourcery.com>

* ld-elf/group10.d: Expect ".group" for the name of group
sections.
* ld-elf/group2.d: Likewise.
* ld-elf/group7.d: Likewise.

22 files changed:
binutils/testsuite/ChangeLog
binutils/testsuite/binutils-all/group-5.d
binutils/testsuite/binutils-all/strip-2.d
gas/ChangeLog
gas/config/obj-elf.c
gas/config/obj-elf.h
gas/config/tc-arm.c
gas/testsuite/ChangeLog
gas/testsuite/gas/elf/elf.exp
gas/testsuite/gas/elf/group0a.d
gas/testsuite/gas/elf/group0b.d
gas/testsuite/gas/elf/group0c.d [new file with mode: 0644]
gas/testsuite/gas/elf/group1a.d
gas/testsuite/gas/elf/group1b.d
gas/testsuite/gas/elf/groupautoa.d
gas/testsuite/gas/elf/groupautob.d
gas/testsuite/gas/elf/section4.d
gas/testsuite/gas/ia64/group-1.d
ld/testsuite/ChangeLog
ld/testsuite/ld-elf/group10.d
ld/testsuite/ld-elf/group2.d
ld/testsuite/ld-elf/group7.d

index 7cd27fce636045c0d0cfd400625b14cef968bc3f..9a9fa8bc960c883df70986011e5cee5d65c8e2fe 100644 (file)
@@ -1,3 +1,9 @@
+2010-10-22  Mark Mitchell  <mark@codesourcery.com>
+
+       * binutils-all/group-5.d: Expect ".group" for the name of group
+       sections.
+       * binutils-all/strip-2.d: Likewise.
+
 2010-10-12  Andreas Schwab  <schwab@linux-m68k.org>
 
        * binutils-all/m68k/objdump.exp: Add fnop test.
index d40fffe94246f9ca6f0ceb9e36bd7abffd2efc82..3c88ba906904466b46dbd1dc1d46820c6b160e29 100644 (file)
@@ -6,13 +6,13 @@
 #readelf: -Sg --wide
 
 #...
-  \[[ 0-9]+\] foo_group[ \t]+GROUP[ \t]+.*
+  \[[ 0-9]+\] \.group[ \t]+GROUP[ \t]+.*
 #...
   \[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AXG.*
 #...
   \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG.*
 #...
-COMDAT group section \[[ 0-9]+\] `foo_group' \[foo_group\] contains 2 sections:
+COMDAT group section \[[ 0-9]+\] `\.group' \[foo_group\] contains 2 sections:
    \[Index\]    Name
    \[[ 0-9]+\]   .text.*
    \[[ 0-9]+\]   .data.*
index 5c54b7ecb824856b6073e6ec845a73cab7936133..9922f475dc9755c2c16e884924f42379d52cb4a3 100644 (file)
@@ -5,13 +5,13 @@
 #name: strip with section group 2
 
 #...
-  \[[ 0-9]+\] foo_group[ \t]+GROUP[ \t]+.*
+  \[[ 0-9]+\] \.group[ \t]+GROUP[ \t]+.*
 #...
   \[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AXG[ \t]+.*
 #...
   \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG[ \t]+.*
 #...
-COMDAT group section \[[ 0-9]+\] `foo_group' \[foo_group\] contains 2 sections:
+COMDAT group section \[[ 0-9]+\] `\.group' \[foo_group\] contains 2 sections:
    \[Index\]    Name
    \[[ 0-9]+\]   .text.*
    \[[ 0-9]+\]   .data.*
index 817adc447a17dddc08d0a16e843901b44da77e2b..b3fb6253d614f26cd277fa50e8e7534afe2d8992 100644 (file)
@@ -1,3 +1,14 @@
+2010-10-23  Mark Mitchell  <mark@codesourcery.com>
+
+       * config/obj-elf.c (elf_adjust_symtab): New.  Move group section
+       processing here from elf_frob_file.  Ensure that group signature
+       symbols have the name of the group.
+       (elf_frob_file): Move group section processing to
+       elf_adjust_symtab.
+       * config/obj-elf.h (elf_adjust_symtab): Declare.
+       (obj_adjust_symtab): Define.
+       * config/tc-arm.c (arm_adjust_symtab): Call elf_adjust_symtab.
+
 2010-10-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * config/tc-sparc.h [TE_SOLARIS] (ELF_TARGET_FORMAT): Define as
index 43820f51e0056ffa40ebaafbf1e0b86c8998bdcd..9f7361648fb835a746173c943a0aeb2d90ec1932 100644 (file)
@@ -2081,32 +2081,29 @@ static void free_section_idx (const char *key ATTRIBUTE_UNUSED, void *val)
 }
 
 void
-elf_frob_file (void)
+elf_adjust_symtab (void)
 {
   struct group_list list;
   unsigned int i;
 
-  bfd_map_over_sections (stdoutput, adjust_stab_sections, NULL);
-
   /* Go find section groups.  */
   list.num_group = 0;
   list.head = NULL;
   list.elt_count = NULL;
-  list.indexes  = hash_new ();
+  list.indexes = hash_new ();
   bfd_map_over_sections (stdoutput, build_group_lists, &list);
-
+  
   /* Make the SHT_GROUP sections that describe each section group.  We
      can't set up the section contents here yet, because elf section
      indices have yet to be calculated.  elf.c:set_group_contents does
      the rest of the work.  */
 for (i = 0; i < list.num_group; i++)
+ for (i = 0; i < list.num_group; i++)
     {
       const char *group_name = elf_group_name (list.head[i]);
       const char *sec_name;
       asection *s;
       flagword flags;
       struct symbol *sy;
-      int has_sym;
       bfd_size_type size;
 
       flags = SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_GROUP;
@@ -2122,17 +2119,7 @@ elf_frob_file (void)
              }
          }
 
-      sec_name = group_name;
-      sy = symbol_find_exact (group_name);
-      has_sym = 0;
-      if (sy != NULL
-         && (sy == symbol_lastP
-             || (sy->sy_next != NULL
-                 && sy->sy_next->sy_previous == sy)))
-       {
-         has_sym = 1;
-         sec_name = ".group";
-       }
+      sec_name = ".group";
       s = subseg_force_new (sec_name, 0);
       if (s == NULL
          || !bfd_set_section_flags (stdoutput, s, flags)
@@ -2145,8 +2132,20 @@ elf_frob_file (void)
 
       /* Pass a pointer to the first section in this group.  */
       elf_next_in_group (s) = list.head[i];
-      if (has_sym)
-       elf_group_id (s) = sy->bsym;
+      /* Make sure that the signature symbol for the group has the
+        name of the group.  */
+      sy = symbol_find_exact (group_name);
+      if (!sy
+         || (sy != symbol_lastP
+             && (sy->sy_next == NULL
+                 || sy->sy_next->sy_previous != sy)))
+       {
+         /* Create the symbol now.  */
+         sy = symbol_new (group_name, now_seg, (valueT) 0, frag_now);
+         symbol_get_obj (sy)->local = 1;
+         symbol_table_insert (sy);
+       }
+      elf_group_id (s) = symbol_get_bfdsym (sy);
 
       size = 4 * (list.elt_count[i] + 1);
       bfd_set_section_size (stdoutput, s, size);
@@ -2155,15 +2154,21 @@ elf_frob_file (void)
       frag_wane (frag_now);
     }
 
-#ifdef elf_tc_final_processing
-  elf_tc_final_processing ();
-#endif
-
   /* Cleanup hash.  */
   hash_traverse (list.indexes, free_section_idx);
   hash_die (list.indexes);
 }
 
+void
+elf_frob_file (void)
+{
+  bfd_map_over_sections (stdoutput, adjust_stab_sections, NULL);
+
+#ifdef elf_tc_final_processing
+  elf_tc_final_processing ();
+#endif
+}
+
 /* It removes any unneeded versioned symbols from the symbol table.  */
 
 void
index c734aab757bbb0937197461ae03d47f2ddee714d..ccfa8d294c9fa65613e781d4f14b037e49e3e915 100644 (file)
@@ -197,6 +197,11 @@ void elf_copy_symbol_attributes (symbolS *, symbolS *);
   (elf_copy_symbol_attributes (DEST, SRC))
 #endif
 
+void elf_adjust_symtab (void);
+#ifndef obj_adjust_symtab
+#define obj_adjust_symtab      elf_adjust_symtab
+#endif
+
 #ifndef SEPARATE_STAB_SECTIONS
 /* Avoid ifndef each separate macro setting by wrapping the whole of the
    stab group on the assumption that whoever sets SEPARATE_STAB_SECTIONS
index 69ff36a68055d18d185e75d01ad5f49c2a440c0f..8dd342bdeca29d89b1517691321a9c8052d2f25b 100644 (file)
@@ -21957,6 +21957,8 @@ arm_adjust_symtab (void)
 
   /* Remove any overlapping mapping symbols generated by alignment frags.  */
   bfd_map_over_sections (stdoutput, check_mapping_symbols, (char *) 0);
+  /* Now do generic ELF adjustments.  */
+  elf_adjust_symtab ();
 #endif
 }
 
index f980f33896d9f2db8ed3c4cdee7ea4f7f59eb655..e2cf0c2b8820fc7f5ab56b4857ee2aca6f402d2d 100644 (file)
@@ -1,3 +1,17 @@
+2010-10-23  Mark Mitchell  <mark@codesourcery.com>
+
+       * gas/elf/elf.exp: Add group0c test.
+       * gas/elf/group0c.d: New.
+       * gas/elf/group0a.d: Expect ".group" for the name of group
+       sections.
+       * gas/elf/group0b.d: Likewise.
+       * gas/elf/group1a.d: Likewise.
+       * gas/elf/group1b.d: Likewise.
+       * gas/elf/groupautoa.d: Likewise.
+       * gas/elf/groupautob.d: Likewise.
+       * gas/elf/section4.d: Likewise.
+       * gas/ia64/group-1.d: Likewise.  Adjust hard-coded constants.
+
 2010-10-22  Nick Clifton  <nickc@redhat.com>
 
        * gas/all/fwdexp.d: Also look for f8ffffff.
index 4aa2b2e6a8784243a3bd6395b80ed84ed28f30dd..52369134651d59ff955437204feb77b3b9c3226b 100644 (file)
@@ -104,6 +104,7 @@ if { ([istarget "*-*-*elf*"]
     }
     run_dump_test "group0a"
     run_dump_test "group0b"
+    run_dump_test "group0c"
     run_dump_test "group1a"
     run_dump_test "group1b"
     run_dump_test "groupautoa"
index 8aedc0caa4f9875ba781345d81ca4c8706cd2523..e6b9366c8b0859889f03eecfbafa7b92b879013f 100644 (file)
@@ -3,7 +3,7 @@
 #source: group0.s
 
 #...
-[      ]*\[.*\][       ]+\.foo_group[  ]+GROUP.*
+[      ]*\[.*\][       ]+\.group[      ]+GROUP.*
 #...
 [      ]*\[.*\][       ]+\.foo[        ]+PROGBITS.*[   ]+AXG[  ]+.*
 [      ]*\[.*\][       ]+\.bar[        ]+PROGBITS.*[   ]+AG[   ]+.*
index 803b8ec797b67792297160cd9fead16d899b5257..fc74ea6398918daf32abb2437166a5341efd3718 100644 (file)
@@ -3,7 +3,7 @@
 #source: group0.s
 
 #...
-COMDAT group section \[    1\] `.foo_group' \[.foo_group\] contains 2 sections:
+COMDAT group section \[    1\] `\.group' \[.foo_group\] contains 2 sections:
 [      ]+\[Index\][    ]+Name
 [      ]+\[.*\][       ]+.foo
 [      ]+\[.*\][       ]+.bar
diff --git a/gas/testsuite/gas/elf/group0c.d b/gas/testsuite/gas/elf/group0c.d
new file mode 100644 (file)
index 0000000..dd3ce90
--- /dev/null
@@ -0,0 +1,7 @@
+#readelf: -sW
+#name: group section name
+#source: group0.s
+
+#...
+.*NOTYPE[      ]+LOCAL[        ]+DEFAULT[      ]+[0-9]+[       ]+\.foo_group
+#pass
index a5b3298757480adcb882902071927d9077c055f6..27da751f75488bff4ab2b60633863570dfacfad0 100644 (file)
@@ -3,7 +3,7 @@
 #source: group1.s
 
 #...
-[      ]*\[.*\][       ]+\.foo_group[  ]+GROUP.*
+[      ]*\[.*\][       ]+\.group[      ]+GROUP.*
 #...
 [      ]*\[.*\][       ]+\.text[       ]+PROGBITS.*[   ]+AX[   ]+.*
 #...
index 704752ba6a36c51e36a2e5bf80640ea990f5a9f5..405e2036f73baf4de2a997c768082c8c8aae6c22 100644 (file)
@@ -3,7 +3,7 @@
 #source: group1.s
 
 #...
-COMDAT group section \[    1\] `.foo_group' \[.foo_group\] contains 1 sections:
+COMDAT group section \[    1\] `\.group' \[.foo_group\] contains 1 sections:
 [      ]+\[Index\][    ]+Name
 [      ]+\[.*\][       ]+.text
 #pass
index a34c35cfa6343ef8b1abbf1d00b480cb85503b1b..57ef2b7fb0a201c815adf4e6523b02b451914277 100644 (file)
@@ -3,7 +3,7 @@
 #source: groupauto.s
 
 #...
-[      ]*\[.*\][       ]+some_group[   ]+GROUP.*
+[      ]*\[.*\][       ]+\.group[      ]+GROUP.*
 #...
 [      ]*\[.*\][       ]+\.text[       ]+PROGBITS.*[   ]+AX[   ]+.*
 #...
index 0ff100725a5683bb5d73e3f0e16121b2b2649a7e..1bd211027d01a1b29177a9b67645856144ce905a 100644 (file)
@@ -3,7 +3,7 @@
 #source: groupauto.s
 
 #...
-COMDAT group section \[    1\] `some_group' \[some_group\] contains 2 sections:
+COMDAT group section \[    1\] `\.group' \[some_group\] contains 2 sections:
 [      ]+\[Index\][    ]+Name
 [      ]+\[.*\][       ]+.text
 [      ]+\[.*\][       ]+.note.bar
index 5cda69ba7351964dfedcccc02630cc996cf66b10..f5bab79ce787aaa7d230ac96965ca13c8aa54068 100644 (file)
@@ -2,7 +2,7 @@
 #name: label arithmetic with multiple same-name sections
 
 #...
-[      ]*\[.*\][       ]+foo[  ]+GROUP.*
+[      ]*\[.*\][       ]+\.group[      ]+GROUP.*
 #...
 [      ]*\[.*\][       ]+\.text[       ]+PROGBITS.*
 #...
index eef78d92d588f00cb0a8420f6e5a17bdd677a8bd..3c824a74fff1466f7fcde4bb2fdb49a5f455c312 100644 (file)
@@ -8,7 +8,7 @@ Section Headers:
        Size              EntSize          Flags  Link  Info  Align
   \[ 0\]                   NULL             0000000000000000  00000000
        0000000000000000  0000000000000000           0     0     0
-  \[ 1\] \._foo             GROUP            0000000000000000  00000040
+  \[ 1\] \.group            GROUP            0000000000000000  00000040
        0000000000000008  0000000000000004           7     6     4
   \[ 2\] \.text             PROGBITS         0000000000000000  00000050
        0000000000000000  0000000000000000  AX       0     0     16
@@ -19,14 +19,14 @@ Section Headers:
   \[ 5\] \.text             PROGBITS         0000000000000000  00000050
        0000000000000010  0000000000000000 AXG       0     0     16
   \[ 6\] \.shstrtab         STRTAB           0000000000000000  00000060
-       0000000000000032  0000000000000000           0     0     1
+       0000000000000033  0000000000000000           0     0     1
   \[ 7\] \.symtab           SYMTAB           0000000000000000  000002d8
-       00000000000000a8  0000000000000018           8     7     8
-  \[ 8\] \.strtab           STRTAB           0000000000000000  00000380
-       0000000000000006  0000000000000000           0     0     1
+       00000000000000c0  0000000000000018           8     8     8
+  \[ 8\] \.strtab           STRTAB           0000000000000000  00000398
+       000000000000000c  0000000000000000           0     0     1
 Key to Flags:
 #...
 
-COMDAT group section \[    1\] `\._foo' \[\._foo\] contains 1 sections:
+COMDAT group section \[    1\] `\.group' \[\._foo\] contains 1 sections:
    \[Index\]    Name
    \[    5\]   \.text
index cbba0c080fce8c3c344ebfff1360106fa26ec82a..dbb22bd3b8955433e9a62b161e578f9f0df48315 100644 (file)
@@ -1,3 +1,10 @@
+2010-10-23  Mark Mitchell  <mark@codesourcery.com>
+
+       * ld-elf/group10.d: Expect ".group" for the name of group
+       sections.
+       * ld-elf/group2.d: Likewise.
+       * ld-elf/group7.d: Likewise.
+
 2010-10-21  Joseph Myers  <joseph@codesourcery.com>
 
        * ld-tic6x/attr-arch-c62x-c62x.d, ld-tic6x/attr-arch-c62x-c64x+.d,
index d22a70ae89e19fbaf6badc55a0f53a2e5c968cef..6fcf83fa8d5d90c5afc5e05e9fb95527c2557d89 100644 (file)
@@ -3,7 +3,7 @@
 #readelf: -Sg --wide
 
 #...
-group section \[[ 0-9]+\] `foo_group' \[foo_group\] contains 4 sections:
+group section \[[ 0-9]+\] `\.group' \[foo_group\] contains 4 sections:
    \[Index\]    Name
    \[[ 0-9]+\]   \.text.*
    \[[ 0-9]+\]   \.rodata\.str.*
index 86ca95225699055dab6e18b8526b087ea43498eb..664c49af7b3a91a147b815679c30856b2591b9a4 100644 (file)
@@ -7,13 +7,13 @@
 # xstormy also uses a non-standard script, putting .data before .text.
 
 #...
-  \[[ 0-9]+\] foo_group[ \t]+GROUP[ \t]+.*
+  \[[ 0-9]+\] \.group[ \t]+GROUP[ \t]+.*
 #...
   \[[ 0-9]+\] \.text.*[ \t]+PROGBITS[ \t0-9a-f]+AXG.*
 #...
   \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG.*
 #...
-COMDAT group section \[[ 0-9]+\] `foo_group' \[foo_group\] contains 2 sections:
+COMDAT group section \[[ 0-9]+\] `\.group' \[foo_group\] contains 2 sections:
    \[Index\]    Name
    \[[ 0-9]+\]   .text.*
    \[[ 0-9]+\]   .data.*
index 401836aaa6bc35342104606992c6abc140c1e04d..602a4c8acc3f4890210c4c4f991e249c3aca39dd 100644 (file)
@@ -9,7 +9,7 @@
 # well with unique group sections under ld -r.
 
 #...
-COMDAT group section \[[ 0-9]+\] `foo_group' \[foo_group\] contains 2 sections:
+COMDAT group section \[[ 0-9]+\] `\.group' \[foo_group\] contains 2 sections:
    \[Index\]    Name
    \[[ 0-9]+\]   .text.foo
    \[[ 0-9]+\]   .data.foo