X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gas%2Fas.c;h=0262a6fec9875ef38da6f4fb851d2a61d247e8c4;hb=7e6ba6a2a56e6195da36329bdeb1654e20aad198;hp=caa1c300ae7cf072ad3926f9ac6335a47f06f88c;hpb=250d07de5cf6efc81ed934c25292beb63c7e3129;p=binutils-gdb.git diff --git a/gas/as.c b/gas/as.c index caa1c300ae7..0262a6fec98 100644 --- a/gas/as.c +++ b/gas/as.c @@ -1,5 +1,5 @@ /* as.c - GAS main program. - Copyright (C) 1987-2021 Free Software Foundation, Inc. + Copyright (C) 1987-2022 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -108,7 +108,7 @@ unsigned int dwarf_level = 3; #if defined OBJ_ELF || defined OBJ_MAYBE_ELF int flag_use_elf_stt_common = DEFAULT_GENERATE_ELF_STT_COMMON; -bfd_boolean flag_generate_build_notes = DEFAULT_GENERATE_BUILD_NOTES; +bool flag_generate_build_notes = DEFAULT_GENERATE_BUILD_NOTES; #endif /* Keep the output file. */ @@ -158,7 +158,7 @@ select_emulation_mode (int argc, char **argv) const char *em = NULL; for (i = 1; i < argc; i++) - if (!strncmp ("--em", argv[i], 4)) + if (startswith (argv[i], "--em")) break; if (i == argc) @@ -474,7 +474,7 @@ parse_args (int * pargc, char *** pargv) OPTION_DEBUG_PREFIX_MAP, OPTION_DEFSYM, OPTION_LISTING_LHS_WIDTH, - OPTION_LISTING_LHS_WIDTH2, + OPTION_LISTING_LHS_WIDTH2, /* = STD_BASE + 10 */ OPTION_LISTING_RHS_WIDTH, OPTION_LISTING_CONT_LINES, OPTION_DEPFILE, @@ -484,7 +484,7 @@ parse_args (int * pargc, char *** pargv) OPTION_GDWARF_3, OPTION_GDWARF_4, OPTION_GDWARF_5, - OPTION_GDWARF_SECTIONS, + OPTION_GDWARF_SECTIONS, /* = STD_BASE + 20 */ OPTION_GDWARF_CIE_VERSION, OPTION_STRIP_LOCAL_ABSOLUTE, OPTION_TRADITIONAL_FORMAT, @@ -494,7 +494,7 @@ parse_args (int * pargc, char *** pargv) OPTION_NOEXECSTACK, OPTION_SIZE_CHECK, OPTION_ELF_STT_COMMON, - OPTION_ELF_BUILD_NOTES, + OPTION_ELF_BUILD_NOTES, /* = STD_BASE + 30 */ OPTION_SECTNAME_SUBST, OPTION_ALTERNATE, OPTION_AL, @@ -503,7 +503,8 @@ parse_args (int * pargc, char *** pargv) OPTION_WARN_FATAL, OPTION_COMPRESS_DEBUG, OPTION_NOCOMPRESS_DEBUG, - OPTION_NO_PAD_SECTIONS /* = STD_BASE + 40 */ + OPTION_NO_PAD_SECTIONS, + OPTION_MULTIBYTE_HANDLING /* = STD_BASE + 40 */ /* When you add options here, check that they do not collide with OPTION_MD_BASE. See as.h. */ }; @@ -581,6 +582,7 @@ parse_args (int * pargc, char *** pargv) ,{"target-help", no_argument, NULL, OPTION_TARGET_HELP} ,{"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT} ,{"warn", no_argument, NULL, OPTION_WARN} + ,{"multibyte-handling", required_argument, NULL, OPTION_MULTIBYTE_HANDLING} }; /* Construct the option lists from the standard list and the target @@ -683,10 +685,23 @@ parse_args (int * pargc, char *** pargv) flag_traditional_format = 1; break; + case OPTION_MULTIBYTE_HANDLING: + if (strcmp (optarg, "allow") == 0) + multibyte_handling = multibyte_allow; + else if (strcmp (optarg, "warn") == 0) + multibyte_handling = multibyte_warn; + else if (strcmp (optarg, "warn-sym-only") == 0) + multibyte_handling = multibyte_warn_syms; + else if (strcmp (optarg, "warn_sym_only") == 0) + multibyte_handling = multibyte_warn_syms; + else + as_fatal (_("unexpected argument to --multibyte-input-option: '%s'"), optarg); + break; + case OPTION_VERSION: /* This output is intended to follow the GNU standards document. */ printf (_("GNU assembler %s\n"), BFD_VERSION_STRING); - printf (_("Copyright (C) 2021 Free Software Foundation, Inc.\n")); + printf (_("Copyright (C) 2022 Free Software Foundation, Inc.\n")); printf (_("\ This program is free software; you may redistribute it under the terms of\n\ the GNU General Public License version 3 or later.\n\ @@ -819,9 +834,10 @@ This program has absolutely no warranty.\n")); /* We end up here for any -gsomething-not-already-a-long-option. give some useful feedback on not (yet) supported -gdwarfxxx versions/sections/options. */ - if (strncmp (old_argv[optind - 1], "-gdwarf", - strlen ("-gdwarf")) == 0) + if (startswith (old_argv[optind - 1], "-gdwarf")) as_fatal (_("unknown DWARF option %s\n"), old_argv[optind - 1]); + else if (old_argv[optind - 1][1] == 'g' && optarg != NULL) + as_fatal (_("unknown option `%s'"), old_argv[optind - 1]); if (md_debug_format_selector) debug_type = md_debug_format_selector (& use_gnu_debug_info_extensions); @@ -862,7 +878,7 @@ This program has absolutely no warranty.\n")); break; case OPTION_GDWARF_SECTIONS: - flag_dwarf_sections = TRUE; + flag_dwarf_sections = true; break; case OPTION_GDWARF_CIE_VERSION: @@ -961,9 +977,9 @@ This program has absolutely no warranty.\n")); case OPTION_SIZE_CHECK: if (strcasecmp (optarg, "error") == 0) - flag_allow_nonconst_size = FALSE; + flag_allow_nonconst_size = false; else if (strcasecmp (optarg, "warning") == 0) - flag_allow_nonconst_size = TRUE; + flag_allow_nonconst_size = true; else as_fatal (_("Invalid --size-check= option: `%s'"), optarg); break; @@ -984,9 +1000,9 @@ This program has absolutely no warranty.\n")); case OPTION_ELF_BUILD_NOTES: if (strcasecmp (optarg, "no") == 0) - flag_generate_build_notes = FALSE; + flag_generate_build_notes = false; else if (strcasecmp (optarg, "yes") == 0) - flag_generate_build_notes = TRUE; + flag_generate_build_notes = true; else as_fatal (_("Invalid --generate-missing-build-notes option: `%s'"), optarg); @@ -1257,12 +1273,10 @@ main (int argc, char ** argv) start_time = get_run_time (); signal_init (); -#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) +#ifdef HAVE_LC_MESSAGES setlocale (LC_MESSAGES, ""); #endif -#if defined (HAVE_SETLOCALE) setlocale (LC_CTYPE, ""); -#endif bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE);