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/compress.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/compress.c')
-rw-r--r-- | bfd/compress.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/bfd/compress.c b/bfd/compress.c index ad3feea..9557984 100644 --- a/bfd/compress.c +++ b/bfd/compress.c @@ -30,6 +30,35 @@ #define MAX_COMPRESSION_HEADER_SIZE 24 +/* +CODE_FRAGMENT +.static inline char * +.bfd_debug_name_to_zdebug (bfd *abfd, const char *name) +.{ +. size_t len = strlen (name); +. char *new_name = bfd_alloc (abfd, len + 2); +. if (new_name == NULL) +. return NULL; +. new_name[0] = '.'; +. new_name[1] = 'z'; +. memcpy (new_name + 2, name + 1, len); +. return new_name; +.} +. +.static inline char * +.bfd_zdebug_name_to_debug (bfd *abfd, const char *name) +.{ +. size_t len = strlen (name); +. char *new_name = bfd_alloc (abfd, len); +. if (new_name == NULL) +. return NULL; +. new_name[0] = '.'; +. memcpy (new_name + 1, name + 2, len - 1); +. return new_name; +.} +. +*/ + static bool decompress_contents (bool is_zstd, bfd_byte *compressed_buffer, bfd_size_type compressed_size, |