diff options
-rw-r--r-- | binutils-2.25/bfd/elfnn-aarch64.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/binutils-2.25/bfd/elfnn-aarch64.c b/binutils-2.25/bfd/elfnn-aarch64.c index 9e58594..b7a3bbe 100644 --- a/binutils-2.25/bfd/elfnn-aarch64.c +++ b/binutils-2.25/bfd/elfnn-aarch64.c @@ -2304,6 +2304,28 @@ elfNN_aarch64_get_stub_entry (const asection *input_section, } +/* Create a stub section. */ + +static asection * +_bfd_aarch64_create_stub_section (asection *section, + struct elf_aarch64_link_hash_table *htab) +{ + size_t namelen; + bfd_size_type len; + char *s_name; + + namelen = strlen (section->name); + len = namelen + sizeof (STUB_SUFFIX); + s_name = bfd_alloc (htab->stub_bfd, len); + if (s_name == NULL) + return NULL; + + memcpy (s_name, section->name, namelen); + memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX)); + return (*htab->add_stub_section) (s_name, section); +} + + /* Find or create a stub section in the stub group for an input section. */ @@ -2323,20 +2345,7 @@ _bfd_aarch64_create_or_find_stub_sec (asection *section, stub_sec = htab->stub_group[link_sec->id].stub_sec; if (stub_sec == NULL) { - size_t namelen; - bfd_size_type len; - char *s_name; - - namelen = strlen (link_sec->name); - len = namelen + sizeof (STUB_SUFFIX); - s_name = bfd_alloc (htab->stub_bfd, len); - if (s_name == NULL) - return NULL; - - memcpy (s_name, link_sec->name, namelen); - memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX)); - stub_sec = (*htab->add_stub_section) (s_name, link_sec); - + 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; |