[AArch64] Refactor section_group[] representation.
authorMarcus Shawcroft <marcus.shawcroft@arm.com>
Sat, 28 Feb 2015 00:17:22 +0000 (00:17 +0000)
committerMarcus Shawcroft <marcus.shawcroft@arm.com>
Tue, 24 Mar 2015 14:10:43 +0000 (14:10 +0000)
Change the behaviour of section_group[] such that .stub_sec points to
the stub section attached to the indexed section rather than the stub
section attached to the link_section pointed to be the index section.

This provides a mechanism to get to the stub section following any
input section.  While still allowing the section grouping mechanism to
find the section group stub section associated with an input section
by first following the link_sec pointer.

bfd/ChangeLog
bfd/elfnn-aarch64.c

index 47afb5c36c027352ec6a04a09c7a56caae26ccd0..07b47b124c9c4def59c62bc8d3702d9ceb46467c 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-24  Marcus Shawcroft  <marcus.shawcroft@arm.com>
+
+       * elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Adjust
+       update of section_group[].stub_sec.
+
 2015-03-24  Marcus Shawcroft  <marcus.shawcroft@arm.com>
 
        * elfnn-aarch64.c (struct aarch64_erratum_835769_fix) Remove.
index 14b4057bb4f12039e602f950916439188e284bed..d5c1fd56b4346bfb956969f3156b5cc1d2ebe586 100644 (file)
@@ -2350,21 +2350,12 @@ _bfd_aarch64_create_or_find_stub_sec (asection *section,
 
   link_sec = htab->stub_group[section->id].link_sec;
   BFD_ASSERT (link_sec != NULL);
-  stub_sec = htab->stub_group[section->id].stub_sec;
-
+  stub_sec = htab->stub_group[link_sec->id].stub_sec;
   if (stub_sec == NULL)
     {
-      stub_sec = htab->stub_group[link_sec->id].stub_sec;
-      if (stub_sec == NULL)
-       {
-         stub_sec = _bfd_aarch64_create_stub_section (link_sec, htab);
-         if (stub_sec == NULL)
-           return NULL;
-         htab->stub_group[link_sec->id].stub_sec = stub_sec;
-       }
-      htab->stub_group[section->id].stub_sec = stub_sec;
+      stub_sec = _bfd_aarch64_create_stub_section (link_sec, htab);
+      htab->stub_group[link_sec->id].stub_sec = stub_sec;
     }
-
   return stub_sec;
 }