This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] [AArch64] Factor out _bfd_aarch64_get_stub_for_link_section.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fc6d53be1893813f5017681a211dd20d560d8c58

commit fc6d53be1893813f5017681a211dd20d560d8c58
Author: Marcus Shawcroft <marcus.shawcroft@arm.com>
Date:   Mon Mar 2 12:11:40 2015 +0000

    [AArch64] Factor out _bfd_aarch64_get_stub_for_link_section.

Diff:
---
 bfd/ChangeLog       |  6 ++++++
 bfd/elfnn-aarch64.c | 30 ++++++++++++++++++------------
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 07b47b1..aad0763 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
 2015-03-24  Marcus Shawcroft  <marcus.shawcroft@arm.com>
 
+	* elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Factor
+	code into:
+	(_bfd_aarch64_get_stub_for_link_section): Define.
+
+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.
 
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index d5c1fd5..2d81199 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -2338,6 +2338,22 @@ _bfd_aarch64_create_stub_section (asection *section,
 }
 
 
+/* Find or create a stub section for a link section.
+
+   Fix or create the stub section used to collect stubs attached to
+   the specified link section.  */
+
+static asection *
+_bfd_aarch64_get_stub_for_link_section (asection *link_section,
+					struct elf_aarch64_link_hash_table *htab)
+{
+  if (htab->stub_group[link_section->id].stub_sec == NULL)
+    htab->stub_group[link_section->id].stub_sec
+      = _bfd_aarch64_create_stub_section (link_section, htab);
+  return htab->stub_group[link_section->id].stub_sec;
+}
+
+
 /* Find or create a stub section in the stub group for an input
    section.  */
 
@@ -2345,18 +2361,8 @@ static asection *
 _bfd_aarch64_create_or_find_stub_sec (asection *section,
 				      struct elf_aarch64_link_hash_table *htab)
 {
-  asection *link_sec;
-  asection *stub_sec;
-
-  link_sec = htab->stub_group[section->id].link_sec;
-  BFD_ASSERT (link_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);
-      htab->stub_group[link_sec->id].stub_sec = stub_sec;
-    }
-  return stub_sec;
+  asection *link_sec = htab->stub_group[section->id].link_sec;
+  return _bfd_aarch64_get_stub_for_link_section (link_sec, htab);
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]