diff options
author | Alan Modra <amodra@gmail.com> | 2010-11-08 02:48:57 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2010-11-08 02:48:57 +0000 |
commit | 4e011fb578429f06c186a2910270d34ea4bb3c8e (patch) | |
tree | 547c4ff12c955f2dc8260e4fd3578577d04a7e33 /bfd/elf.c | |
parent | fff50f7175e03e9edebf8eeefb1a9d51046860c4 (diff) | |
download | gdb-4e011fb578429f06c186a2910270d34ea4bb3c8e.zip gdb-4e011fb578429f06c186a2910270d34ea4bb3c8e.tar.gz gdb-4e011fb578429f06c186a2910270d34ea4bb3c8e.tar.bz2 |
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/elf.c')
-rw-r--r-- | bfd/elf.c | 31 |
1 files changed, 26 insertions, 5 deletions
@@ -822,11 +822,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, const struct elf_backend_data *bed; if (hdr->bfd_section != NULL) - { - BFD_ASSERT (strcmp (name, - bfd_get_section_name (abfd, hdr->bfd_section)) == 0); - return TRUE; - } + return TRUE; newsect = bfd_make_section_anyway (abfd, name); if (newsect == NULL) @@ -1016,6 +1012,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, || (name[1] == 'z' && name[7] == '_'))) { enum { nothing, compress, decompress } action = nothing; + char *new_name; if (bfd_is_section_compressed (abfd, newsect)) { @@ -1030,6 +1027,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, action = compress; } + new_name = NULL; switch (action) { case nothing: @@ -1042,6 +1040,17 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, abfd, name); return FALSE; } + if (name[1] != 'z') + { + unsigned int len = strlen (name); + + new_name = bfd_alloc (abfd, len + 2); + if (new_name == NULL) + return FALSE; + new_name[0] = '.'; + new_name[1] = 'z'; + memcpy (new_name + 2, name + 1, len); + } break; case decompress: if (!bfd_init_section_decompress_status (abfd, newsect)) @@ -1051,8 +1060,20 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, abfd, name); return FALSE; } + if (name[1] == 'z') + { + unsigned int len = strlen (name); + + new_name = bfd_alloc (abfd, len); + if (new_name == NULL) + return FALSE; + new_name[0] = '.'; + memcpy (new_name + 1, name + 2, len - 1); + } break; } + if (new_name != NULL) + bfd_rename_section (abfd, newsect, new_name); } return TRUE; |