From 857bddbe737bc963bd9e5a3b24743a9bba5d2d7b Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 3 Oct 2022 09:11:00 +0200 Subject: 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. --- gas/as.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) (limited to 'gas/as.c') diff --git a/gas/as.c b/gas/as.c index 9ce3d62..a5c2d24 100644 --- a/gas/as.c +++ b/gas/as.c @@ -250,21 +250,16 @@ Options:\n\ fprintf (stream, _("\ --alternate initially turn on alternate macro syntax\n")); -#ifdef DEFAULT_FLAG_COMPRESS_DEBUG fprintf (stream, _("\ --compress-debug-sections[={none|zlib|zlib-gnu|zlib-gabi|zstd}]\n\ - compress DWARF debug sections using zlib [default]\n")); + compress DWARF debug sections\n")), fprintf (stream, _("\ - --nocompress-debug-sections\n\ - don't compress DWARF debug sections\n")); -#else - fprintf (stream, _("\ - --compress-debug-sections[={none|zlib|zlib-gnu|zlib-gabi|zstd}]\n\ - compress DWARF debug sections using zlib\n")); + Default: %s\n"), + bfd_get_compression_algorithm_name (flag_compress_debug)); + fprintf (stream, _("\ --nocompress-debug-sections\n\ - don't compress DWARF debug sections [default]\n")); -#endif + don't compress DWARF debug sections\n")); fprintf (stream, _("\ -D produce assembler debugging messages\n")); fprintf (stream, _("\ @@ -741,24 +736,13 @@ This program has absolutely no warranty.\n")); if (optarg) { #if defined OBJ_ELF || defined OBJ_MAYBE_ELF - if (strcasecmp (optarg, "none") == 0) - flag_compress_debug = COMPRESS_DEBUG_NONE; - else if (strcasecmp (optarg, "zlib") == 0) - flag_compress_debug = COMPRESS_DEBUG_GABI_ZLIB; - else if (strcasecmp (optarg, "zlib-gnu") == 0) - flag_compress_debug = COMPRESS_DEBUG_GNU_ZLIB; - else if (strcasecmp (optarg, "zlib-gabi") == 0) - flag_compress_debug = COMPRESS_DEBUG_GABI_ZLIB; - else if (strcasecmp (optarg, "zstd") == 0) - { -#ifdef HAVE_ZSTD - flag_compress_debug = COMPRESS_DEBUG_ZSTD; -#else + flag_compress_debug = bfd_get_compression_algorithm (optarg); +#ifndef HAVE_ZSTD + if (flag_compress_debug == COMPRESS_DEBUG_ZSTD) as_fatal (_ ("--compress-debug-sections=zstd: gas is not " "built with zstd support")); #endif - } - else + if (flag_compress_debug == COMPRESS_UNKNOWN) as_fatal (_("Invalid --compress-debug-sections option: `%s'"), optarg); #else -- cgit v1.1