diff options
author | Martin Liska <mliska@suse.cz> | 2022-10-03 09:11:00 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-10-11 14:13:26 +0200 |
commit | 857bddbe737bc963bd9e5a3b24743a9bba5d2d7b (patch) | |
tree | 487913f1480b0ace5fa040e07f2b839c9eb00175 /ld | |
parent | c6422d7be70f14bf7140085f2fc7a592737f5df5 (diff) | |
download | gdb-857bddbe737bc963bd9e5a3b24743a9bba5d2d7b.zip gdb-857bddbe737bc963bd9e5a3b24743a9bba5d2d7b.tar.gz gdb-857bddbe737bc963bd9e5a3b24743a9bba5d2d7b.tar.bz2 |
refactor usage of compressed_debug_section_type
bfd/ChangeLog:
* bfd-in.h (bfd_hash_set_default_size): Add COMPRESS_UNKNOWN
enum value.
(struct compressed_type_tuple): New.
* bfd-in2.h (bfd_hash_set_default_size): Regenerate.
(struct compressed_type_tuple): Likewise.
* libbfd.c (ARRAY_SIZE): New macro.
(bfd_get_compression_algorithm): New function.
(bfd_get_compression_algorithm_name): Likewise.
gas/ChangeLog:
* as.c: Do not special-case, use the new functions.
ld/ChangeLog:
* emultempl/elf.em: Do not special-case, use the new functions.
* lexsup.c (elf_static_list_options): Likewise.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/emultempl/elf.em | 22 | ||||
-rw-r--r-- | ld/lexsup.c | 8 |
2 files changed, 9 insertions, 21 deletions
diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em index acd66f9..5dfc03a 100644 --- a/ld/emultempl/elf.em +++ b/ld/emultempl/elf.em @@ -660,24 +660,16 @@ gld${EMULATION_NAME}_handle_option (int optc) break; case OPTION_COMPRESS_DEBUG: - if (strcasecmp (optarg, "none") == 0) - link_info.compress_debug = COMPRESS_DEBUG_NONE; - else if (strcasecmp (optarg, "zlib") == 0) - link_info.compress_debug = COMPRESS_DEBUG_GABI_ZLIB; - else if (strcasecmp (optarg, "zlib-gnu") == 0) - link_info.compress_debug = COMPRESS_DEBUG_GNU_ZLIB; - else if (strcasecmp (optarg, "zlib-gabi") == 0) - link_info.compress_debug = COMPRESS_DEBUG_GABI_ZLIB; - else if (strcasecmp (optarg, "zstd") == 0) + link_info.compress_debug = bfd_get_compression_algorithm (optarg); + if (strcasecmp (optarg, "zstd") == 0) { -#ifdef HAVE_ZSTD - link_info.compress_debug = COMPRESS_DEBUG_ZSTD; -#else - einfo (_ ("%F%P: --compress-debug-sections=zstd: ld is not built " - "with zstd support\n")); +#ifndef HAVE_ZSTD + if (link_info.compress_debug == COMPRESS_DEBUG_ZSTD) + einfo (_ ("%F%P: --compress-debug-sections=zstd: ld is not built " + "with zstd support\n")); #endif } - else + if (link_info.compress_debug == COMPRESS_UNKNOWN) einfo (_("%F%P: invalid --compress-debug-sections option: \`%s'\n"), optarg); break; diff --git a/ld/lexsup.c b/ld/lexsup.c index 299371f..0c01c99 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -2148,13 +2148,9 @@ elf_static_list_options (FILE *file) fprintf (file, _("\ --compress-debug-sections=[none|zlib|zlib-gnu|zlib-gabi|zstd]\n\ Compress DWARF debug sections\n")); -#ifdef DEFAULT_FLAG_COMPRESS_DEBUG fprintf (file, _("\ - Default: zlib-gabi\n")); -#else - fprintf (file, _("\ - Default: none\n")); -#endif + Default: %s\n"), + bfd_get_compression_algorithm_name (link_info.compress_debug)); fprintf (file, _("\ -z common-page-size=SIZE Set common page size to SIZE\n")); fprintf (file, _("\ |