diff options
author | Alan Modra <amodra@gmail.com> | 2022-12-04 12:29:19 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-12-04 12:51:46 +1030 |
commit | 13917d936e367b0c42d4c32566e1017ff8e15520 (patch) | |
tree | a902a4c52dd5fe559f12013bf7538fbd00864f6f /bfd/coffgen.c | |
parent | 13556f4057d37f510f77143a1632febcc5618d1f (diff) | |
download | gdb-13917d936e367b0c42d4c32566e1017ff8e15520.zip gdb-13917d936e367b0c42d4c32566e1017ff8e15520.tar.gz gdb-13917d936e367b0c42d4c32566e1017ff8e15520.tar.bz2 |
Renaming .debug to .zdebug and vice versa
Move a couple of elf.c functions to compress.c.
* compress.c (bfd_debug_name_to_zdebug): New inline function.
(bfd_zdebug_name_to_debug): Likewise.
* elf.c (convert_debug_to_zdebug, convert_zdebug_to_debug): Delete.
(_bfd_elf_make_section_from_shdr, elf_fake_sections),
(_bfd_elf_assign_file_positions_for_non_load): Adjust to suit.
* coffgen.c (make_a_section_from_file): Use new inlines here.
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r-- | bfd/coffgen.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c index aab41c3..f2c71b1 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -181,19 +181,12 @@ make_a_section_from_file (bfd *abfd, abfd, name); return false; } - if (return_section->compress_status == COMPRESS_SECTION_DONE) + if (return_section->compress_status == COMPRESS_SECTION_DONE + && name[1] != 'z') { - 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); - } + new_name = bfd_debug_name_to_zdebug (abfd, name); + if (new_name == NULL) + return false; } break; case decompress: @@ -207,13 +200,9 @@ make_a_section_from_file (bfd *abfd, } if (name[1] == 'z') { - unsigned int len = strlen (name); - - new_name = bfd_alloc (abfd, len); + new_name = bfd_zdebug_name_to_debug (abfd, name); if (new_name == NULL) return false; - new_name[0] = '.'; - memcpy (new_name + 1, name + 2, len - 1); } break; } |