From patchwork Thu Apr 20 13:31:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YunQiang Su X-Patchwork-Id: 85913 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp338167vqo; Thu, 20 Apr 2023 06:31:51 -0700 (PDT) X-Google-Smtp-Source: AKy350b5CFueTlSjUrNZOy1NpRrRv1fMmI96MTPxBRx6d/EE+HXm108r3XWDyZCv6vfSCnEqlPa3 X-Received: by 2002:aa7:d392:0:b0:4fe:ddf:8d8c with SMTP id x18-20020aa7d392000000b004fe0ddf8d8cmr1796036edq.13.1681997510803; Thu, 20 Apr 2023 06:31:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681997510; cv=pass; d=google.com; s=arc-20160816; b=AEh1bgkKMB7HeRGs2NMVEDliEt3S3sl6bRfsjzgZ8ZcZpAZO/dgYzd6VZfBrefRn3v caJFc61wyOb8THGH6KFHY2CgOW8/VRZUN3t4MPwnTjnwdOoon7YmE4SHAyJeQxOJh0iR rwPZhIfHDPAlg4qEX2XM7LfOwFw6ZD7Bidf/d9SDAtkd2tKeLFI8nGSLxFr8ooft5AUG L7blRCIdBa8MvN/Nl42CcojaQ+166aroMTp7ymfwUoX0bu0wZ3TVcrj4LrD1Sr2M4qPu FnE4kg2O3HL5XKbw52Z1qzOlNvgQ5le1anqdZuXB7iIofLykTSoNqzoE3GgO1gTehFPY Khlg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dmarc-filter:delivered-to; bh=TcwBvAi3oJ3qLtqfrePYUEbFnJO7WTL+HCTY1qYBIL4=; b=WbErtfqDvs1SONm4mteSTx32S0MG1h75KHKANVsOETs3+V1HDsuwcrkKUZc7Z70Q5U GSggTvd0LObIt/WdNKJ3cfRiiiWkRgz0UfrdhjZAaM/iuEJyTm3fGQmZ6Fbezdyxopvd CzmL7+m+zx8Ut5dBCfNJJ87l4ar/fTcHKI4MldMz6KZk2QgjHPsuU+earmqJHeDVE6Io yEcKKEIjvCYzas+T7CEIPDx1es6dBrbTAZWsXIi2+F+jVhcktmygkApA6Bl7une/R0Rq 0LB5jnNo1J1Ru0C81Z4hzwhWppgyIdGdOrP7L+m0MFsfHdTxUatsQJfDOwX9Hmtvf1hF kkCA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cipunited.onmicrosoft.com header.s=selector1-cipunited-onmicrosoft-com header.b=SV91sq2a; arc=pass (i=1 spf=pass spfdomain=cipunited.com dkim=pass dkdomain=cipunited.com dmarc=pass fromdomain=cipunited.com); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d11-20020a05640208cb00b0050698e7cb11si1915692edz.356.2023.04.20.06.31.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 06:31:50 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@cipunited.onmicrosoft.com header.s=selector1-cipunited-onmicrosoft-com header.b=SV91sq2a; arc=pass (i=1 spf=pass spfdomain=cipunited.com dkim=pass dkdomain=cipunited.com dmarc=pass fromdomain=cipunited.com); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3DD5F3858C20 for ; Thu, 20 Apr 2023 13:31:43 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2103.outbound.protection.outlook.com [40.107.117.103]) by sourceware.org (Postfix) with ESMTPS id A98393858C83 for ; Thu, 20 Apr 2023 13:31:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A98393858C83 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cipunited.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cipunited.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bEgfdP4ecfnKUTm5ALeMwuzpEjuukCG7GG82iQV81QsDLKTD7NIGFxk1wH8R66A+Cax5B9bbKCaccQScnF8JRigEmNBFoDE8tNW+uG854BvczJpb3mPhTOByaR1pXrAdEfMPPhIZzPoT+90BjKRuiFnuGoCTHcxuk8oVNBrI8AuYSZ/0abg36c0GEjccfeHU07d9SV1/rmRatVDMM+DKJ3Eo3TYOzvVwzvu23oq/wDMkl+fGOwmRns3mmVaHziNapSCnCe+X0/rpISDoxmryouHNFc/bP+wp+eO9PnS5nwmD+GxCgpgxgTItX1CEwibG/VxdH9dYLxHvSbI8XZe8Pg== 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=TcwBvAi3oJ3qLtqfrePYUEbFnJO7WTL+HCTY1qYBIL4=; b=m1WlneeXl9f4ciHSrzcJeYLEJxHAgSCaLHsRb3bZoAFmHyUXhxp+OhgbaPgI9TNu4ISNJ9ImzGlehTdgDoW4m5y1/zB4P4vW7eG3A6Ohgfs/JzMavRihN9AYJnE7e+ibtVrAIrvjS1bDt8BLs7iYdbPz/KhVGSUj+idvlRlsbqgFBvwz67iC49g14D4b5pQivdfIvd63LrJ+m2dm/Y9u7XEudFpLkSUaIYQoy2VyKuMb8IJmWk+FjwghBxFIy2v2lrptfBBlno4EpcAXG7n2zUXcFJFy2aIH5W2L5O6a3izv9gyg9/YfHhOgJ/Dwh9hCmVPUrszwLbAowAy0B+2LmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cipunited.com; dmarc=pass action=none header.from=cipunited.com; dkim=pass header.d=cipunited.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cipunited.onmicrosoft.com; s=selector1-cipunited-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TcwBvAi3oJ3qLtqfrePYUEbFnJO7WTL+HCTY1qYBIL4=; b=SV91sq2a1lYLJRiWdSiEr7LpC6MFo4NaszUSLj6M71kFSwqNt17+L5ptx72UvdPbBirSwQilNYUV2u2oO/Hgm1ZYOjbs3PgzRgknatjrBiqB/1OkJEiGNFCXoKKTIK3q1xGe3M83pAkFOMxgtMAbZ3+LHMBvtZA5IB2Tzg9R+Oo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=cipunited.com; Received: from TYZPR04MB6117.apcprd04.prod.outlook.com (2603:1096:400:25a::9) by SEZPR04MB6172.apcprd04.prod.outlook.com (2603:1096:101:ce::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Thu, 20 Apr 2023 13:31:28 +0000 Received: from TYZPR04MB6117.apcprd04.prod.outlook.com ([fe80::4016:87b:f0d1:b150]) by TYZPR04MB6117.apcprd04.prod.outlook.com ([fe80::4016:87b:f0d1:b150%6]) with mapi id 15.20.6319.022; Thu, 20 Apr 2023 13:31:28 +0000 From: YunQiang Su To: binutils@sourceware.org Cc: syq@debian.org, macro@orcam.me.uk, xry111@xry111.site, richard.sandiford@arm.com, jiaxun.yang@flygoat.com, YunQiang Su Subject: [PATCH v5 2/2] MIPS: default output r6 obj if the triple is r6 Date: Thu, 20 Apr 2023 21:31:02 +0800 Message-Id: <20230420133102.2422583-2-yunqiang.su@cipunited.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230420133102.2422583-1-yunqiang.su@cipunited.com> References: <20230418140019.2195551-2-yunqiang.su@cipunited.com> <20230420133102.2422583-1-yunqiang.su@cipunited.com> X-ClientProxiedBy: TYCP301CA0017.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:381::8) To TYZPR04MB6117.apcprd04.prod.outlook.com (2603:1096:400:25a::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR04MB6117:EE_|SEZPR04MB6172:EE_ X-MS-Office365-Filtering-Correlation-Id: a2d0f9be-b9bf-493e-2249-08db41a38baa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zGTwjZeaSvUeeJCR/sVEMQRB5tfKJX52oPLvl3WGVxg+8tkdWwqrpWUyZpF1yWFRWvSSnpYVpBhU7fcsczUigHzhX5KCwcGsGJuVnmfMLQ69I84uI+1oscZX+wcOI39A0FHh0b92n3YXziSLn34xusXvYp3nqpc+fu7jLhrZ6kG7JCu128fPL6M1X02CwrzKtxze6+3R7NykpK6Oom18lvHGPt/98Wh2ohJWaDp/i1XuUwtQ72Cw8SWCdbA5csYfE+5/X1vefeAR6IX65FL5EPLAQ0vuFmjtOqyiwj/XkFigliCqOcxpN6bx81tzi0QpQLqXZsGy0Wnx4SL12uylY6aEGsX1posgT1i3jDZ+Q9S8zsW860eNgi4Kge8+PVzjgJCa0GupW0WPUPyoq+bc2iTBlCswkOPmtvAD/Kulu8uSu4ynh2MNtCuamsHkH8Cy1wQf/C6zwUMbBTMbMCxFKUWVDf64PP/bK/90IaRiaNli9epss0dk1XFZ9ROYGnuulQxl9AJx+l0XkTuK8sJhMXNZZRy5KIk84+NGgYZ3FeG6VlOsDEqr6Wk3bHIdj8YJPZsTblqqpbkX68hXaSsd2kBUdghLxycPZUVrHEl8rzzngmU/m6XPor3IuChduFkJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYZPR04MB6117.apcprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(346002)(39830400003)(136003)(376002)(396003)(451199021)(36756003)(4326008)(316002)(6916009)(66556008)(66476007)(66946007)(478600001)(52116002)(6666004)(6486002)(8936002)(5660300002)(41300700001)(8676002)(2906002)(86362001)(38100700002)(38350700002)(2616005)(1076003)(107886003)(6512007)(26005)(6506007)(83380400001)(186003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q+Vaimk93z60Awx/hCU5W0gUnoSuUaCH2Sa3xLWlQYr/qNWFQB3e0KMckqVOlkabFhNEblqijkVKKawH/JnE6RdPwX1kcHF+Js8Pk79FXnBymS/DS6SXK1fjpIWv3BLvchcT7eJ25KWsbtdM0N07mvJ6XQR41S1uEE4sigvNZ+AsWJjwdoo/UCksqQEeECMjZu41nT28UaJ4tLnT/8Ld2VtIqGc1udchtPgI1SYYNSLz1gqMq7BYocQYZVR3fBL7OxPkhRaZ3QcjQh1GAhAC2Vdk1ZjC0+FZkWZ41A42Y/y1E+lrnou3IdjB7FX/JYiZoWAsf3mCi1LAU7QtJV3oJrO+Zat6ISpXOaCT+MvShCp3M6GjSAAl4ykqVTBtNVWceOo5L85oKK494vGRi6kKTefqgFO3JnIT0Vf/368zYuB8wsgJKhPLfqj50qIWEwJ0+YEpBkqmAl3h6PRjglzQNR51CoXRfVnUi0q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sewRyni4JdKGPWVC/vg4aYErX+2O1umKpffkqAafyj1n/57hMfuHR1o4FhGlA== X-OriginatorOrg: cipunited.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2d0f9be-b9bf-493e-2249-08db41a38baa X-MS-Exchange-CrossTenant-AuthSource: TYZPR04MB6117.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2023 13:31:28.4608 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e31cf5b5-ee69-4d5f-9c69-edeeda2458c0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zA2nGuuYAcXSm9bp18WFV9rkfP0NzyshqsNQXr8ZNs1R2YCM3l9nHiEGHlgd8M9Ol81FX8l3YSiYBc54ZC156NOCoKv9E9mobNhU6aYXbJE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR04MB6172 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_NUMSUBJECT, 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: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763523209248696759?= X-GMAIL-MSGID: =?utf-8?q?1763702222049436052?= If the triple is mipsisa32r6* or mipsisa64r6*, ld/as should output r6 objects by default. The triples with vendor `img` should do same. The examples include: as xx.s -o xx.o ld -r -b binary xx.dat -o xx.o --- bfd/config.bfd | 6 ++++++ bfd/elfxx-mips.c | 4 ++-- bfd/elfxx-mips.h | 4 ++++ gas/configure | 9 +++++++++ gas/configure.ac | 9 +++++++++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/bfd/config.bfd b/bfd/config.bfd index 1e4bea191dd..78752994456 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -1535,3 +1535,9 @@ case "${targ_defvec} ${targ_selvecs}" in targ_archs="$targ_archs bfd_iamcu_arch" ;; esac + +case "${targ}" in + mipsisa32r6* | mipsisa64r6* | mips*-img-*) + targ_cflags="$targ_cflags -DMIPS_DEFAULT_R6=1" + ;; +esac diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 13a89953293..c9cd2f8099f 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -12327,9 +12327,9 @@ mips_set_isa_flags (bfd *abfd) { default: if (ABI_N32_P (abfd) || ABI_64_P (abfd)) - val = E_MIPS_ARCH_3; + val = MIPS_DEFAULT_R6 ? E_MIPS_ARCH_64R6 : E_MIPS_ARCH_3; else - val = E_MIPS_ARCH_1; + val = MIPS_DEFAULT_R6 ? E_MIPS_ARCH_32R6 : E_MIPS_ARCH_1; break; case bfd_mach_mips3000: diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index 4addf6f5d1a..f15dceac48e 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -29,6 +29,10 @@ enum reloc_check check_shuffle }; +#ifndef MIPS_DEFAULT_R6 +#define MIPS_DEFAULT_R6 0 +#endif + extern bool _bfd_mips_elf_mkobject (bfd *); extern bool _bfd_mips_elf_close_and_cleanup diff --git a/gas/configure b/gas/configure index 868f4a911a9..0daa80d5b4c 100755 --- a/gas/configure +++ b/gas/configure @@ -12211,6 +12211,15 @@ _ACEOF use_e_mips_abi_o32=1 ;; esac + # If Vendor is IMG, then MIPSr6 is used + case ${target} in + mips*64*-img-*) + mips_cpu=mips64r6 + ;; + mips*-img-*) + mips_cpu=mips32r6 + ;; + esac # Decide whether to generate 32-bit or 64-bit code by default. # Used to resolve -march=from-abi when an embedded ABI is selected. case ${target} in diff --git a/gas/configure.ac b/gas/configure.ac index 03728ffce4d..2b91f9ec616 100644 --- a/gas/configure.ac +++ b/gas/configure.ac @@ -380,6 +380,15 @@ changequote([,])dnl use_e_mips_abi_o32=1 ;; esac + # If Vendor is IMG, then MIPSr6 is used + case ${target} in + mips*64*-img-*) + mips_cpu=mips64r6 + ;; + mips*-img-*) + mips_cpu=mips32r6 + ;; + esac # Decide whether to generate 32-bit or 64-bit code by default. # Used to resolve -march=from-abi when an embedded ABI is selected. case ${target} in