From patchwork Tue Aug 15 11:13:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YunQiang Su X-Patchwork-Id: 74149 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 02455385B531 for ; Tue, 15 Aug 2023 11:14:44 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2095.outbound.protection.outlook.com [40.107.215.95]) by sourceware.org (Postfix) with ESMTPS id 8712B3858404 for ; Tue, 15 Aug 2023 11:14:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8712B3858404 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=JKuyUXYkLk3V8Ko4kcRlBQayWCQqQz6frEUnJLC9/JmZsAZ6B/thEhvjQsCqUIuAbL/5VSOUsmHy5Df2PSRe/HEbVCAKO1Nf5DrdMJ4BDm7r1PEcFU6M4igyIyq6kxO7h7dRbvzOkv5ae6MBH6F7MR6AcS76BeZAU1UwZt7TneOSM6VGdZ7rC1yaEIlhKGEmyyJFE/PRXl6X3+LT0BL4OkMSWtjq4EkURlyB+Rc7dgjolLMjrW3+7ze/xPMtjLXbmTkNs3U9SEJ7ImOgIzHmEL2XUV6fGAE7y5zccH2LvPzfoT+5HQMuz6dhoIZsySE72u19br7cfc2FHMFJ2TQpBA== 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=8XweMbkFzpVT87bGmFAFMsYJf6VfgLqSGklidVrETec=; b=FL8cPGYm5+wJW/Y7F9KVZNW0F4Lu+ldCXwq33pw1Re59dp59ocqkxVCClA4kBn11bYWYKFJHE7YPds4rcMEWGzAqw4EOpEr+BdcH0FCmNz9ILG5F4DQSurejJsnL/UJZzL8Vao1pwBmRZOg4RktGVrCydqLPupGQp3AoS034IGahr6kUPbYALVXQKGLJlZOjabtpkUUr1ieq16ngnyYhYVtBoKdFC/PruFibKOVeNUWMtNhpg+WjC4tbzHzkXVbDrvPtnqBJg113CF3NkCpAx20M5EH2n1hIPRiIccUKz4FEYTp6M/yvJW5eOYYaw0njNlFP0YDIKgmOgVdb19aS4Q== 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=8XweMbkFzpVT87bGmFAFMsYJf6VfgLqSGklidVrETec=; b=GfOXprQZeFAIDMQ6sNHeUDXHSRWhG6LxDaeerGfVpN2pZykXXFjI14xoFxTmRCGB2Ibw5XaFfNlPW6VIWqqhql6H1KtDGCJZAiAh1OSU9laPdL9QglRuBRYNc4fyvEeQMG/q7DSXwIzzP4g6yemkRUiUgWR92B6Nonjo2JUyw24= 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 TY0PR04MB5887.apcprd04.prod.outlook.com (2603:1096:400:214::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.24; Tue, 15 Aug 2023 11:14:17 +0000 Received: from TYZPR04MB6117.apcprd04.prod.outlook.com ([fe80::b15:a53e:604e:a735]) by TYZPR04MB6117.apcprd04.prod.outlook.com ([fe80::b15:a53e:604e:a735%3]) with mapi id 15.20.6678.025; Tue, 15 Aug 2023 11:14:17 +0000 From: YunQiang Su To: macro@orcam.me.uk Cc: binutils@sourceware.org, YunQiang Su Subject: [PATCH] MIPS: Fix Irix gas testcases Date: Tue, 15 Aug 2023 19:13:51 +0800 Message-Id: <20230815111351.140551-1-yunqiang.su@cipunited.com> X-Mailer: git-send-email 2.30.2 X-ClientProxiedBy: FR0P281CA0242.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:af::12) To TYZPR04MB6117.apcprd04.prod.outlook.com (2603:1096:400:25a::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR04MB6117:EE_|TY0PR04MB5887:EE_ X-MS-Office365-Filtering-Correlation-Id: 62a05920-c276-423c-4d5e-08db9d80c34d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SKnfToo6vPNNfAacHCz095DC98rWl8IdSNkOsMxP1//Q6nWtS/Hg406tluO6inPyQmU+jynQYoYMumm0LreauLtQUtHr8rgB5AFjeuWzuyJDxQTuTl1BtYADBPSg80tTCL37UrlUkuiaYbqD1wmHcxl9doEECS7y1ZP1Vf9LuT12QvSqiciKIzjXGvDob3L+dYc3RZvP7skOkxqI1ai6Jg1Sk3Ahc2ldkE1G+B+FTKPnMlzkmiRhp9Mno/6Vg8P1LDgmd5bg0P+LLMYZS66Nr85M8vuHK3hG2D7SQxYLfmG83QalnHLKK8CjU1sGbTdW91YXiqHD3VvyXGwQmf4/8RX+PIc90EdeidjsbvGtc5wuAYzPGehCVulExLYoPAOFhhJbhe3HhTQw1nYOowPD38QHy9ztNkWu95nCVGAqmlCBTmZlYEaz4V76xgLNEFEcthfgbEq+PV3nTkj/3lS6yyJgHnBe9FG8DPZUGt+Voqb2FLATGMjXVPrltSRBiwRrdwgwVSxmNQS8aE7klklh0b/9rnNgYiy5kDDtZdm10DNRAhE83QrND/TSwMXoGtlNOiEcxhrf+LFx23A1z5t0pPZ7yh4CDoyNf4t0YcW6QRk= 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)(376002)(346002)(136003)(39830400003)(396003)(366004)(186006)(1800799006)(451199021)(83380400001)(36756003)(86362001)(41300700001)(478600001)(66946007)(38350700002)(66476007)(6916009)(66556008)(316002)(6512007)(8676002)(5660300002)(4326008)(8936002)(38100700002)(2616005)(1076003)(107886003)(26005)(6486002)(6666004)(2906002)(6506007)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: t4bL+M+/PtvLACy1unoQ+lEiJbwDEx1w7bYEPatawCr4GoIXjWDIbbhZnh6cEqxc0s4eLAnaaClqgLFut7wWrd6yjogPxv/+8iEYcihibJQgQDxjCcq53I904CceV6gBO4s916mHsGuQIbxEmMV1HmVWm8vPIbAqacZJg/l8F2rrnB3fAnqXsfCKeg/R5dW7iB6e8CfMO6S6CJwh656/ONBf3LLtAHwVCZ7SGmzupFMGQKvvu/Ng5p7YQoV1N6a7NCI303AItv2vahXA0aKvKDa6F5IuyWu4/mxHLzMyPwiWlG3CN5FpyZw38hEwGlI4HlyiMCz0RC4t2Qu3eip3KdUCMTgj4zvFvJjlaNEplmSH+kmFdItG+4LdIEf6DLE3Tdq1QZrOvjQvxYCNXN3szZmb3pi/09zImWmqICA7teu3U31l1GRhZ6QUZp034dAuUXSISg8LLcWDmwnUEv8omn+Jk2RdBvfwIF5vU4JhFIvW4TQrMaH5xMqsJRwsBeo7i4g7AY+PZWLGlAywnR4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+icfyGZTEOybUFXtcZGUcT3A== X-OriginatorOrg: cipunited.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62a05920-c276-423c-4d5e-08db9d80c34d X-MS-Exchange-CrossTenant-AuthSource: TYZPR04MB6117.apcprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2023 11:14:16.9225 (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: w+3Dqx3OkW3OTVayjlDOvnP6H6Hzpt422NRw81km4tMd+dnZdgkmgoZJMs+iZfA+OfEtrkyY0D8BPnswNos4SeJUAG9r6lvZueLWJEGFWRs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR04MB5887 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP 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+patchwork=sourceware.org@sourceware.org Sender: "Binutils" 1. Add -mpdr option to cases, which expect .pdr section existing. Gas doesn't generate .pdr section for Irix objects by default. See `int mips_flag_pdr` in tc-mips.c. 2. Add irix-no-pdr.d testcase to make sure no .pdr section generates for Irix by default. 3. Add and use call-nonpic-1-irix.d for Irix targets. Gas doesn't set O32 flags for Irix objects in e_flags. See `use_e_mips_abi_o32` in gas/configure.ac. 4. Add mips16-e-irix.d: g1 is marked as O on Irix. The Irix 5 and 6 assemblers set the type of any common symbol and any undefined non-function symbol to STT_OBJECT. See `mips_frob_symbol` in tc-mips.c. --- gas/testsuite/gas/elf/elf.exp | 4 ++ gas/testsuite/gas/mips/call-nonpic-1-irix.d | 30 +++++++++++++ gas/testsuite/gas/mips/elf-rel26.d | 2 +- gas/testsuite/gas/mips/irix-no-pdr.d | 8 ++++ gas/testsuite/gas/mips/mips.exp | 11 ++++- gas/testsuite/gas/mips/mips16-e-irix.d | 50 +++++++++++++++++++++ gas/testsuite/gas/mips/mips16-e.d | 2 +- gas/testsuite/gas/mips/mips16-f.d | 2 +- gas/testsuite/gas/mips/mips16-hilo-match.d | 2 +- 9 files changed, 105 insertions(+), 6 deletions(-) create mode 100644 gas/testsuite/gas/mips/call-nonpic-1-irix.d create mode 100644 gas/testsuite/gas/mips/irix-no-pdr.d create mode 100644 gas/testsuite/gas/mips/mips16-e-irix.d diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp index 9e389ff1859..bb63e8f612f 100644 --- a/gas/testsuite/gas/elf/elf.exp +++ b/gas/testsuite/gas/elf/elf.exp @@ -207,6 +207,10 @@ if { [is_elf_format] } then { riscv*-*-* { set as_flags "$as_flags -march-attr" } + mips*-*-* { + # Irix has no pdr section by default. + set as_flags "$as_flags -mpdr" + } } run_elf_list_test "section2" "$target_machine" "$as_flags" "-s" "" } diff --git a/gas/testsuite/gas/mips/call-nonpic-1-irix.d b/gas/testsuite/gas/mips/call-nonpic-1-irix.d new file mode 100644 index 00000000000..3cff1ca672b --- /dev/null +++ b/gas/testsuite/gas/mips/call-nonpic-1-irix.d @@ -0,0 +1,30 @@ +#as: -mabi=32 -mips2 -call_nonpic +#objdump: -pdr +#source: call-nonpic-1.s + +.* +private flags = 10000004: .* + +MIPS ABI Flags Version: 0 + +ISA: MIPS2 +GPR size: 32 +CPR1 size: 32 +CPR2 size: 0 +FP ABI: Hard float \(double precision\) +ISA Extension: None +ASEs: + None +FLAGS 1: 00000000 +FLAGS 2: 00000000 + + +Disassembly of section \.text: + +0+0 <\.text>: +.* lui t9,0x0 +.*: R_MIPS_HI16 foo +.* addiu t9,t9,0 +.*: R_MIPS_LO16 foo +.* jalr t9 +.* nop diff --git a/gas/testsuite/gas/mips/elf-rel26.d b/gas/testsuite/gas/mips/elf-rel26.d index aeb4e16d178..71fbe83d4b6 100644 --- a/gas/testsuite/gas/mips/elf-rel26.d +++ b/gas/testsuite/gas/mips/elf-rel26.d @@ -1,4 +1,4 @@ -#as: -mips32 -32 -EL -KPIC +#as: -mips32 -32 -EL -KPIC -mpdr #readelf: --relocs #name: MIPS ELF reloc 26 diff --git a/gas/testsuite/gas/mips/irix-no-pdr.d b/gas/testsuite/gas/mips/irix-no-pdr.d new file mode 100644 index 00000000000..7268e020c9f --- /dev/null +++ b/gas/testsuite/gas/mips/irix-no-pdr.d @@ -0,0 +1,8 @@ +#objdump: -rst +#name: Irix has no .pdr section +#as: -32 -mips32 +#source: sync.s + +#failif +.*\.pdr.* +#pass diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp index 91cf8b11077..185f80b9316 100644 --- a/gas/testsuite/gas/mips/mips.exp +++ b/gas/testsuite/gas/mips/mips.exp @@ -1242,7 +1242,7 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test "comdat-reloc" - run_dump_test "${tmips}mips${el}16-e" + run_dump_test "${tmips}mips${el}16-e${imips}" run_dump_test "${tmips}mips${el}16-f" run_dump_test "elf-consthilo" @@ -1539,7 +1539,8 @@ if { [istarget mips*-*-vxworks*] } { [mips_arch_list_matching mips1 !singlefloat] run_dump_test "mips16-vis-1" - run_dump_test "call-nonpic-1" + # Irix sets use_e_mips_abi_o32=0. See gas/configure.ac. + run_dump_test "call-nonpic-1${imips}" run_dump_test "mips32-sync" run_dump_test_arches "mips32r2-sync" [lsort -dictionary -unique [concat \ [mips_arch_list_matching mips32r2] \ @@ -2167,4 +2168,10 @@ if { [istarget mips*-*-vxworks*] } { run_dump_test "global-local-symtab-sort-n32${tmips}" run_dump_test "global-local-symtab-sort-n64${tmips}" } + + # Gas doesn't generate .pdr section for Irix objects by default. + # See `int mips_flag_pdr` in tc-mips.c. + if [istarget *-*-irix*] { + run_dump_test "irix-no-pdr" + } } diff --git a/gas/testsuite/gas/mips/mips16-e-irix.d b/gas/testsuite/gas/mips/mips16-e-irix.d new file mode 100644 index 00000000000..1b473deb281 --- /dev/null +++ b/gas/testsuite/gas/mips/mips16-e-irix.d @@ -0,0 +1,50 @@ +#objdump: -rst --special-syms -mips16 +#name: MIPS16 reloc +#as: -32 -mips16 -mips32 -mpdr +#source: mips16-e.s + +# The Irix 5 and 6 assemblers set the type of any common symbol and +# any undefined non-function symbol to STT_OBJECT. +# See `mips_frob_symbol` in tc-mips.c. + +# Check MIPS16 reloc processing + +.*: +file format elf.*mips.* + +SYMBOL TABLE: +0+0000000 l d \.text 0+0000000 (|\.text) +0+0000000 l d \.data 0+0000000 (|\.data) +0+0000000 l d \.bss 0+0000000 (|\.bss) +0+0000000 l d foo 0+0000000 (|foo) +0+0000000 l d \.reginfo 0+0000000 (|\.reginfo) +0+0000000 l d \.MIPS\.abiflags 0+0000000 (|\.MIPS\.abiflags) +0+0000000 l d \.(mdebug|pdr) 0+0000000 (|\.mdebug|\.pdr) +0+0000000 l d \.gnu\.attributes 0+0000000 (|\.gnu\.attributes) +0+0000002 l \.text 0+0000000 0xf0 l1 +0+0000004 l \.text 0+0000000 0xf0 \.L1.*1 +0+0000000 O \*UND\* 0+0000000 g1 + + +RELOCATION RECORDS FOR \[foo\]: +OFFSET +TYPE +VALUE +0+0000000 R_MIPS_32 l1 +0+0000004 R_MIPS_32 l1 +0+0000008 R_MIPS_32 \.L1.*1 +0+000000c R_MIPS_32 \.L1.*1 +0+0000010 R_MIPS_32 g1 +0+0000014 R_MIPS_32 g1 + + +Contents of section \.text: + 0000 65006500 65006500 65006500 65006500 .* +Contents of section \.reginfo: + 0000 00010000 00000000 00000000 00000000 .* + 0010 00000000 00000000 .* +Contents of section \.MIPS\.abiflags: + .* + .* +Contents of section foo: + 0000 00000000 00000008 00000000 00000003 .* + 0010 00000000 00000008 00000000 00000000 .* +Contents of section \.gnu\.attributes: + .* diff --git a/gas/testsuite/gas/mips/mips16-e.d b/gas/testsuite/gas/mips/mips16-e.d index d64b882c81c..9a7c3e82c0c 100644 --- a/gas/testsuite/gas/mips/mips16-e.d +++ b/gas/testsuite/gas/mips/mips16-e.d @@ -1,6 +1,6 @@ #objdump: -rst --special-syms -mips16 #name: MIPS16 reloc -#as: -32 -mips16 +#as: -32 -mips16 -mips32 -mpdr # Check MIPS16 reloc processing diff --git a/gas/testsuite/gas/mips/mips16-f.d b/gas/testsuite/gas/mips/mips16-f.d index 9605b6f183e..0ed246cfbba 100644 --- a/gas/testsuite/gas/mips/mips16-f.d +++ b/gas/testsuite/gas/mips/mips16-f.d @@ -1,6 +1,6 @@ #objdump: -rst -mips16 #name: MIPS16 reloc 2 -#as: -32 -mips16 +#as: -32 -mips16 -mips32 -mpdr # Check MIPS16 reloc processing diff --git a/gas/testsuite/gas/mips/mips16-hilo-match.d b/gas/testsuite/gas/mips/mips16-hilo-match.d index 76ad7b39cdd..7b42f6946c1 100644 --- a/gas/testsuite/gas/mips/mips16-hilo-match.d +++ b/gas/testsuite/gas/mips/mips16-hilo-match.d @@ -1,5 +1,5 @@ #objdump: -r -#as: -mabi=32 -march=mips1 +#as: -mabi=32 -march=mips1 -mpdr #name: MIPS16 mips16-hilo-match .*: +file format .*mips.*