aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@codesourcery.com>2011-03-02 17:07:03 +0000
committerBernd Schmidt <bernds@codesourcery.com>2011-03-02 17:07:03 +0000
commitddcf1fcfb23a8f27e67cd8b0a60ab4dae05b7fa8 (patch)
tree894db9e1ddb4e19def65dbf1fcdbbe41328dabe2 /bfd
parent9a5193cb858fc753c5f74f81abde85a8df753498 (diff)
downloadbinutils-ddcf1fcfb23a8f27e67cd8b0a60ab4dae05b7fa8.zip
binutils-ddcf1fcfb23a8f27e67cd8b0a60ab4dae05b7fa8.tar.gz
binutils-ddcf1fcfb23a8f27e67cd8b0a60ab4dae05b7fa8.tar.bz2
* elflink.c (is_reloc_section): Remove function.
(get_dynamic_reloc_section_name): Construct string manually.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.c37
2 files changed, 11 insertions, 31 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e99450e..407738e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-02 Bernd Schmidt <bernds@codesourcery.com>
+
+ * elflink.c (is_reloc_section): Remove function.
+ (get_dynamic_reloc_section_name): Construct string manually.
+
2011-02-28 Kai Tietz <kai.tietz@onevision.com>
* archive.c (_bfd_find_nested_archive): Use filename_(n)cmp.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index dffe0ae..983d5e0 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -12597,20 +12597,6 @@ _bfd_elf_default_got_elt_size (bfd *abfd,
/* Routines to support the creation of dynamic relocs. */
-/* Return true if NAME is a name of a relocation
- section associated with section S. */
-
-static bfd_boolean
-is_reloc_section (bfd_boolean rela, const char * name, asection * s)
-{
- if (rela)
- return CONST_STRNEQ (name, ".rela")
- && strcmp (bfd_get_section_name (NULL, s), name + 5) == 0;
-
- return CONST_STRNEQ (name, ".rel")
- && strcmp (bfd_get_section_name (NULL, s), name + 4) == 0;
-}
-
/* Returns the name of the dynamic reloc section associated with SEC. */
static const char *
@@ -12618,26 +12604,15 @@ get_dynamic_reloc_section_name (bfd * abfd,
asection * sec,
bfd_boolean is_rela)
{
- const char * name;
- unsigned int strndx = elf_elfheader (abfd)->e_shstrndx;
- unsigned int shnam = _bfd_elf_single_rel_hdr (sec)->sh_name;
+ char *name;
+ const char *old_name = bfd_get_section_name (NULL, sec);
+ const char *prefix = is_rela ? ".rela" : ".rel";
- name = bfd_elf_string_from_elf_section (abfd, strndx, shnam);
- if (name == NULL)
+ if (old_name == NULL)
return NULL;
- if (! is_reloc_section (is_rela, name, sec))
- {
- static bfd_boolean complained = FALSE;
-
- if (! complained)
- {
- (*_bfd_error_handler)
- (_("%B: bad relocation section name `%s\'"), abfd, name);
- complained = TRUE;
- }
- name = NULL;
- }
+ name = bfd_alloc (abfd, strlen (prefix) + strlen (old_name) + 1);
+ sprintf (name, "%s%s", prefix, old_name);
return name;
}