diff options
author | Marcus Shawcroft <marcus.shawcroft@arm.com> | 2015-03-10 13:16:28 +0000 |
---|---|---|
committer | Marcus Shawcroft <marcus.shawcroft@arm.com> | 2015-03-23 16:06:55 +0000 |
commit | 665856756517ff4eb0c31c07f5c7e1666ccd4445 (patch) | |
tree | ec11c7cf2020bfca02959b7d8c40b15dc3ec6b69 /bfd | |
parent | ef8575212574f5cca4426194d7428f900a573852 (diff) | |
download | gdb-665856756517ff4eb0c31c07f5c7e1666ccd4445.zip gdb-665856756517ff4eb0c31c07f5c7e1666ccd4445.tar.gz gdb-665856756517ff4eb0c31c07f5c7e1666ccd4445.tar.bz2 |
[AArch64] Factor stub creation code into _bfd_aarch64_create_stub_section.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elfnn-aarch64.c | 37 |
2 files changed, 29 insertions, 14 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 386cff9..e281c7f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,11 @@ 2015-03-23 Marcus Shawcroft <marcus.shawcroft@arm.com> + * elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Factor stub + creation code into... + (bfd_aarch64_create_stub_section): Define. + +2015-03-23 Marcus Shawcroft <marcus.shawcroft@arm.com> + * elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Rename from elf_aarch64_create_or_find_stub_sec. (_bfd_aarch64_add_stub_entry_in_group): Rename from diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 1db5942..5f80a2d 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -2327,6 +2327,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. */ @@ -2346,20 +2368,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; |