summaryrefslogtreecommitdiff
path: root/bfd/section.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2010-11-08 02:48:53 +0000
committerAlan Modra <amodra@bigpond.net.au>2010-11-08 02:48:53 +0000
commita21e91c6604036d32acbec4d34e4e9fe081cc34f (patch)
tree403df6c3f6c7dac0d6e6ff36279f7f8d6661cebe /bfd/section.c
parentfed33f270cf1350ebd6d8606ec64f385ce418aa7 (diff)
downloadbinutils-redhat-a21e91c6604036d32acbec4d34e4e9fe081cc34f.tar.gz
bfd/
* hash.c (bfd_hash_hash): Extract from.. (bfd_hash_lookup): ..here. (bfd_hash_rename): New function. * section.c (bfd_rename_section): New function. * bfd-in.h (bfd_hash_rename): Declare. * bfd-in2.h: Regenerate. * elf.c (_bfd_elf_make_section_from_shdr): Rename input sections when compressing or decompressing. Don't assert name match. * elf64-hppa.c (get_reloc_section): Don't assert name match. * elfxx-ia64.c (get_reloc_section): Likewise. binutils/ * objcopy.c (copy_main): No need to rename sections when compressing or decompressing. binutils/testsuite/ * binutils-all/objdump.W: Adjust expected result for debug section rename.
Diffstat (limited to 'bfd/section.c')
-rw-r--r--bfd/section.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/bfd/section.c b/bfd/section.c
index 51c2196bc4..bff8adfb07 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -1215,6 +1215,29 @@ bfd_set_section_flags (bfd *abfd ATTRIBUTE_UNUSED,
/*
FUNCTION
+ bfd_rename_section
+
+SYNOPSIS
+ void bfd_rename_section
+ (bfd *abfd, asection *sec, const char *newname);
+
+DESCRIPTION
+ Rename section @var{sec} in @var{abfd} to @var{newname}.
+*/
+
+void
+bfd_rename_section (bfd *abfd, sec_ptr sec, const char *newname)
+{
+ struct section_hash_entry *sh;
+
+ sh = (struct section_hash_entry *)
+ ((char *) sec - offsetof (struct section_hash_entry, section));
+ sh->section.name = newname;
+ bfd_hash_rename (&abfd->section_htab, newname, &sh->root);
+}
+
+/*
+FUNCTION
bfd_map_over_sections
SYNOPSIS