From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130040.outbound.protection.outlook.com [40.107.13.40]) by sourceware.org (Postfix) with ESMTPS id 9BEED383F94E for ; Thu, 30 Jun 2022 12:54:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9BEED383F94E ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lyKHKbpMEiaWQfvxIew5o8638+VdklXvdsaIZ44/sph74T6NNe8mh69yr4jn7Qn5eU1D08/UgfejFceSdk7itnGPawZgjUL5F02P8jigInfOkX2+Iw4epWtoM5Ddhq7PTwQ96ZSX3sWL8LzStMWHtL3Gle/Wk/R/OcDne8dFBiuEH5TtXRrG8/86nY1AmGNiHTlEydsTLwQIpQ2nqLyyZpXuR+wlDkXApO88zoxXJYeY6eVn7fOeX7/AFMgUINnlauyK+6QLCNWfNSj7wndM1uWGVfr9lBRisdkCIvcmlpnDAVkNNfK4ac/bbNRYu/v8ojUto24aPtdvihD3SThSqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=445MRsPxPmsOewUo0l3pN8zro6uf3YTj8cMO6QrIhuM=; b=jxPt1a9TdHniYK7YjiUy9GvzvQqOW1J/91OlODjH6+kXSY84YDp8b3W2Y5x32z9ga5nr5O6CM33N2w0r6NcFKtTj/tqt6Sg2j5hFDCdVjoDgWFzsKut4z+ZoopBdr/iv9y7JRs/BZ/I/aaYY60CDmmZeDmhCfqHT6RVo8HvkvZMRGDQ8VtR3us1YUM4MfhjmwkiC7H9a/He84HUt/OdyxIEPxgXq07caPiawKFvRvRMxBqIrI/7QhoAdJ5nlXzztYAO+khLfaggOddXZesezAUr9SUnI6BZR98IEl+/DmiBwkPy0IM6MDA9lts6/rz7ihywkWsOSGwDCniUviqMHng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AM6PR04MB4629.eurprd04.prod.outlook.com (2603:10a6:20b:24::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14; Thu, 30 Jun 2022 12:53:59 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::dfa:a64a:432f:e26b]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::dfa:a64a:432f:e26b%7]) with mapi id 15.20.5395.014; Thu, 30 Jun 2022 12:53:59 +0000 Message-ID: Date: Thu, 30 Jun 2022 14:53:57 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: [PATCH 3/7] x86: permit "default" with .arch Content-Language: en-US To: Binutils References: <01f502ff-5b51-86d3-ed54-646df7d22037@suse.com> From: Jan Beulich In-Reply-To: <01f502ff-5b51-86d3-ed54-646df7d22037@suse.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR3P281CA0084.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1f::20) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e0fb3d8-7d57-4895-9e92-08da5a9799ac X-MS-TrafficTypeDiagnostic: AM6PR04MB4629:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FnkMdoTsm5h///ucsICWJDrfrNHGdq6KAovj+aR+vqNwqab7lZmyZH+YvbYvNjlLScf3Trr6F7h/S0uZ8Sp8sZD9SHfbQKceGBc28BkhiBlKlp87r+TORA/tHa3gMMnYrcHCcMUSIq97mn3kADfnfhGP2s4NNGdL0/bcfWnegO4+RVH4JGId2GZt4/8HY29mIklsswRle91Z5qhfSiP9FK4WoWoJ16L9j0cDTMXQkuU1lKx/H0VfUtlXoitRxvCz8PZSr8TzRGTFyUvgmtlgLouCiVonaidSfZ+3cp9nJP7scfkkyLlXtcxYWXuM4Xlmaiqhmpe2LLLpRlfOYzEriu7FzSSQABUOROWtUVbs7DSSDd3b1+HfRf96SERCpJ1WHz6qsKHlQAJguSNF9JyNeuNTdErq0X84alwXRLY3jbZQxYo5pDJFug5hz4D941yEoGTufxGsjsZzWF19Xep+wgsk7dY8zlaGMROnb5fDgM03A+yimhs2JLYiGuh03sfgqxOM8Zm3KgH5xZXFPJ7HprzqJMr/SdzxKO4HwlEi3ncJ+LfDtXMsoCz+13JC3FL3uaiiPMA1xpEC0A3OFpPrfT6WWm87eME1eM0OHvEFbC2ze2t4V+njF0yTgGxLCiW0BcS34yz1jnHNVblPQeBMjOoAV2JKITPnDqWxTuQC5UoQtYXllOayU+FxKKY4viSQkE+AtW50q6QHDdCipRkaw3zcwxhOil30aSjRJbf6QmFNkLMdKzbOyYbqhgFn8AVffhvdHwAcuSEdlTSpn+GxPg+U3XwtUGQHc/c/7CwnFLKcR0+prlR5nu0aq/KxpSgwmsZ6bLQ6GrSJybI9r/+fdYnjVedlxeKYQcSyf/kdGeB7LRFt600Yoyi6dZNHDCvX X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6560.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(346002)(136003)(396003)(376002)(39860400002)(8936002)(31686004)(41300700001)(186003)(36756003)(83380400001)(5660300002)(2906002)(31696002)(6512007)(6916009)(6486002)(8676002)(2616005)(66556008)(66476007)(86362001)(478600001)(66946007)(4326008)(26005)(6506007)(38100700002)(316002)(142923001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Vnd1dkxjbDRVYVN5SDhBM0F4VTdKR3hCdVFLNTYrRGNPd1JGdEhEaTdsdGpL?= =?utf-8?B?REg3TkJRK1JVdGdoUEdrYUpqL2tXeUh1eDFtMVNpTGxqVU9XbnZDZlg2ZVN4?= =?utf-8?B?dGRiMlBuYWlXZmtDRVZiWk9DTkk5MzI3VXcvUnhiQjhMUGc4Y3RITHdReUgr?= =?utf-8?B?WWpvdjhTaTlnQ2dRWVpUcWlKeTNsNnUyckxDV0swN1QyUVMwUTZ2R2x4RFBx?= =?utf-8?B?eGdoY2dsV0RIcTVXQ283ay9Bdzc0RE1XTk5tM2VzQjBmT2UwM21vSm1mRjlK?= =?utf-8?B?dkhiSWtLTDNSdjJBTEl6cFoxN0Q0SGthOWsxSVZTSDF3cVdRNXZrV2ZJV3h0?= =?utf-8?B?SXRpZWJURTZsSDZEZFYxSzFIbVlPaXBYdzNUazlZTGI1YTZDRFM4L0ZJTDF6?= =?utf-8?B?WjZtTGgzSmc3YnovU1lXZjN5aFhFQnZ0TTJSdnJYK1ltR1JMaVljNlpMT2Yx?= =?utf-8?B?S3MyU3ZwSjI2R2xuQXZaN3dJdlBvM0FOQk9VR1pNYXlPMC9GSWs3aUlPbmxN?= =?utf-8?B?RHB3WWVhVi9UbnY1TWVpMEhqd3RZQVlyQXNiYnRWZjFld2xjZlcwNnBKTnhI?= =?utf-8?B?d0k3QldOOXRNYmRmbzhpekhQU0h2a0puTm9oRUtEbGI0VVUzWE5RYlBOWVZt?= =?utf-8?B?U1lKdVBxcWpCY0FHUWpBK2pYSEVCcXdIaGRWcW1sajdPZHBKTjRzbmxpbVln?= =?utf-8?B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NHFLaDJi?= =?utf-8?B?VEVNMERKUSsrSHkzU0RhOXRzSGxtUGI2eW90OU9DZnN6NkQyTnNQTlJxYjFq?= =?utf-8?B?QlFkWTUvaW1Qb0FJUllLK3BmNHpQOXRkWGpIUUZZU1BaS3NYTXJDTExodTlP?= =?utf-8?B?OTYzN3VUWk5WaHhRM2RLMXNVeUdlZXc3YTIrekhjeHVHUkovbW1VSUdEaE92?= =?utf-8?B?NzBIc0VBRFVaVGRaOWkxU2JsaWI2RHhEM1RjeEluQ0tkZThRWitCUXY2bXdF?= =?utf-8?B?ZVpLRXZ0MmU5eGtaUTVhTXJNNzRqZXhnbWRnWFJCMnhLeW5sbVVDT0NNTFFn?= =?utf-8?B?UzgwWWlzNHNxRFJRbnRwcHVhNGtBS0FqbUtWM2FEVHk1S2U2STduWUNGdmt6?= =?utf-8?B?S1NJMVRhVnZVaUZaMHh2aXNTNEVvU01qVHp5UXZUUDMvb0RhTklIcFFYd1Fp?= =?utf-8?B?T053dCtpSlJtdU02M3FNVXdsTHA3WFQzTGx2L3RNbVRSZGJrUjR2a2FpcDBh?= =?utf-8?Q?Vm1pWzKIxbihfhuvcjos4Ppu9?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e0fb3d8-7d57-4895-9e92-08da5a9799ac X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2022 12:53:59.2072 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WMt3Ef0NuBmehiERA2oaklGYWIYsTGjcrqcKF2Ro8IN9C9cNjJ1gageHrjdcvhP03JnmWD1Md2OF5kWEyHGE1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4629 X-Spam-Status: No, score=-3030.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2022 12:54:03 -0000 So far there was no way to reset the architecture to that assembly would start with in the absence of any overrides (command line or directives). Note that for Intel MCU "default" is merely an alias of "iamcu". While there also zap a stray @item from the doc section, as noticed when inspecting the generated output (which still has some quirks, but those aren't easy to address without re-flowing almost the entire section). --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -933,8 +933,8 @@ const relax_typeS md_relax_table[] = static const arch_entry cpu_arch[] = { - /* Do not replace the first two entries - i386_target_format() - relies on them being there in this order. */ + /* Do not replace the first two entries - i386_target_format() and + set_cpu_arch() rely on them being there in this order. */ { STRING_COMMA_LEN ("generic32"), PROCESSOR_GENERIC32, CPU_GENERIC32_FLAGS, 0 }, { STRING_COMMA_LEN ("generic64"), PROCESSOR_GENERIC64, @@ -2867,12 +2867,47 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED if (!is_end_of_line[(unsigned char) *input_line_pointer]) { - char *string; - int e = get_symbol_name (&string); - unsigned int j; + char *s; + int e = get_symbol_name (&s); + const char *string = s; + unsigned int j = 0; i386_cpu_flags flags; - for (j = 0; j < ARRAY_SIZE (cpu_arch); j++) + if (strcmp (string, "default") == 0) + { + if (strcmp (default_arch, "iamcu") == 0) + string = default_arch; + else + { + static const i386_cpu_flags cpu_unknown_flags = CPU_UNKNOWN_FLAGS; + + cpu_arch_name = NULL; + xfree (cpu_sub_arch_name); + cpu_sub_arch_name = NULL; + cpu_arch_flags = cpu_unknown_flags; + if (flag_code == CODE_64BIT) + { + cpu_arch_flags.bitfield.cpu64 = 1; + cpu_arch_flags.bitfield.cpuno64 = 0; + } + else + { + cpu_arch_flags.bitfield.cpu64 = 0; + cpu_arch_flags.bitfield.cpuno64 = 1; + } + cpu_arch_isa = PROCESSOR_UNKNOWN; + cpu_arch_isa_flags = cpu_arch[flag_code == CODE_64BIT].flags; + if (!cpu_arch_tune_set) + { + cpu_arch_tune = cpu_arch_isa; + cpu_arch_tune_flags = cpu_arch_isa_flags; + } + + j = ARRAY_SIZE (cpu_arch) + 1; + } + } + + for (; j < ARRAY_SIZE (cpu_arch); j++) { if (strcmp (string, cpu_arch[j].name) == 0) { @@ -2945,7 +2980,7 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED j = ARRAY_SIZE (cpu_arch); } - if (j >= ARRAY_SIZE (cpu_arch)) + if (j == ARRAY_SIZE (cpu_arch)) as_bad (_("no such architecture: `%s'"), string); *input_line_pointer = e; @@ -13841,6 +13876,13 @@ show_arch (FILE *stream, int ext, int ch p = start; left = size - (start - message); + + if (!ext && check) + { + p = output_message (stream, p, message, start, &left, + STRING_COMMA_LEN ("default")); + } + for (j = 0; j < ARRAY_SIZE (cpu_arch); j++) { /* Should it be skipped? */ --- a/gas/doc/c-i386.texi +++ b/gas/doc/c-i386.texi @@ -1504,6 +1504,7 @@ directive enables a warning when gas det supported on the CPU specified. The choices for @var{cpu_type} are: @multitable @columnfractions .20 .20 .20 .20 +@item @samp{default} @item @samp{i8086} @tab @samp{i186} @tab @samp{i286} @tab @samp{i386} @item @samp{i486} @tab @samp{i586} @tab @samp{i686} @tab @samp{pentium} @item @samp{pentiumpro} @tab @samp{pentiumii} @tab @samp{pentiumiii} @tab @samp{pentium4} @@ -1531,7 +1532,7 @@ supported on the CPU specified. The cho @item @samp{.avx512_vpopcntdq} @tab @samp{.avx512_vbmi2} @tab @samp{.avx512_vnni} @item @samp{.avx512_bitalg} @tab @samp{.avx512_bf16} @tab @samp{.avx512_vp2intersect} @item @samp{.tdx} @tab @samp{.avx_vnni} @tab @samp{.avx512_fp16} -@item @samp{.clwb} @tab @samp{.rdpid} @tab @samp{.ptwrite} @tab @item @samp{.ibt} +@item @samp{.clwb} @tab @samp{.rdpid} @tab @samp{.ptwrite} @tab @samp{.ibt} @item @samp{.wbnoinvd} @tab @samp{.pconfig} @tab @samp{.waitpkg} @tab @samp{.cldemote} @item @samp{.shstk} @tab @samp{.gfni} @tab @samp{.vaes} @tab @samp{.vpclmulqdq} @item @samp{.movdiri} @tab @samp{.movdir64b} @tab @samp{.enqcmd} @tab @samp{.tsxldtrk} --- /dev/null +++ b/gas/testsuite/gas/i386/arch-dflt.l @@ -0,0 +1,19 @@ +.*: Assembler messages: +.*:3: Error:.*`cmovl'.* +.*:9: Error:.*`cmovg'.* +GAS LISTING .* + + +[ ]*[0-9]*[ ]+\.text +[ ]*[0-9]*[ ]+start: +[ ]*[0-9]*[ ]+cmovl %eax, %ecx +[ ]*[0-9]*[ ]* +[ ]*[0-9]*[ ]+\.arch default +[ ]*[0-9]*[ ]+\?\?\?\? 0F4DC8[ ]+cmovnl %eax, %ecx +[ ]*[0-9]*[ ]* +[ ]*[0-9]*[ ]+\.arch generic32 +[ ]*[0-9]*[ ]+cmovg %eax, %ecx +[ ]*[0-9]*[ ]* +[ ]*[0-9]*[ ]+\.arch default +[ ]*[0-9]*[ ]+\?\?\?\? 0F4EC8[ ]+cmovng %eax, %ecx +#pass --- /dev/null +++ b/gas/testsuite/gas/i386/arch-dflt.s @@ -0,0 +1,14 @@ + .text +start: + cmovl %eax, %ecx + + .arch default + cmovnl %eax, %ecx + + .arch generic32 + cmovg %eax, %ecx + + .arch default + cmovng %eax, %ecx + + .end --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -205,6 +205,7 @@ if [gas_32_check] then { run_dump_test "arch-12" run_dump_test "arch-13" run_dump_test "arch-14" + run_list_test "arch-dflt" "-march=generic32 -al" run_dump_test "8087" run_dump_test "287" run_dump_test "387"