From patchwork Fri Jan 5 09:17:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: changjiachen X-Patchwork-Id: 185314 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp6109970dyb; Fri, 5 Jan 2024 01:18:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHzTmG70DHTDTjLgnbK71xr6qVXahw7EYEbHWdwIpWuq8rpvnIdYsqiyTY8MH3TxlTSt1B X-Received: by 2002:a81:8203:0:b0:5f4:6d32:f109 with SMTP id s3-20020a818203000000b005f46d32f109mr2191614ywf.40.1704446302952; Fri, 05 Jan 2024 01:18:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704446302; cv=pass; d=google.com; s=arc-20160816; b=waCRcgyuGuPT5b5R8oWi/iohcafyVWaVNMC66nTjoz3fqFHP743va8eXEQ2ugzTHCk T9qW7DkZXkF7EJhCVaI26SbuBJS1bn42T3vD4I5rK9LThIjtqzArm62/0J9aqrO8rliQ avQVGlzL8cWe1L/okxX5fjYZHDa5V8FPdHkyX14KCwyRrd8j5bv2xthIBxXvxpLju7iY PypSZwkLX7UFT3+NFBDXSnk0s3ABVgESAn3/t64baq7n6ua5fj6A+67z4Vh98QtxwCD5 DPqg+KCKvm4v7SYzdimFn2VdaMGSm/d42OZrUCbV3jfvU2GljT2HLBj/OQn+PDlPEcv3 Xkpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:arc-filter :dmarc-filter:delivered-to; bh=a3yPNv7UioC5h7GsNF1lS6imjQ2UnZH9IswgxnP0hL0=; fh=uTF/VfpCAq2GtcL5NdCKul3VKQPlBSDYmUlZE/0CcYM=; b=IGn7UutIc7m1lokG6N5k/Amr46LI/RF2RfC1g2lgQK4aXYaWNLnWLEm933pH10UvMO DZuA/yfcBg1rrFnCJ2vtNikDcuAs+VIl3dM3arWoRi716jXAHdmBRgjPUO78j9xfoBM6 /yvVPZwAxS/oGVKWxv5M4OnkmU92En7Wc298gaz3+7sEM8yM1xDVbq0MoWViFAn1IPUN uw0XbbB3aRAdRjCNNiYKaHE32u0gsI+giAuKHueb0215CuKMcRgDBUs4I0JEBz6OA7L2 PEGWeejHAtwbflwx397tyVcxV+WmPwFqqDHuaE3f1SSU6qrKHXQge13vjRgERWcORuXA fV3Q== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xupt.edu.cn Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id j5-20020a0cf505000000b0067f9c419238si1363066qvm.34.2024.01.05.01.18.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 01:18:22 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xupt.edu.cn Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9DC27385DC33 for ; Fri, 5 Jan 2024 09:18:22 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-m49198.qiye.163.com (mail-m49198.qiye.163.com [45.254.49.198]) by sourceware.org (Postfix) with ESMTPS id 569AB3858C29 for ; Fri, 5 Jan 2024 09:18:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 569AB3858C29 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=stu.xupt.edu.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=stu.xupt.edu.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 569AB3858C29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=45.254.49.198 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704446287; cv=none; b=EJes5xnRGkgMKcKPjU4v4Vs7wCaRShSWW5uJz4edFbSefKlXnSXzlMTSdycFufe9Wi3l3JkwcXP1TSNRFgiyQj+oZIJkSAhl4GcZ7HlCV81gv9hm/nItndDFcyP1u5H9aJoYfpCi3PyfyYak9NalmdWK6tV1lrWyXYvmGZN6J8k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704446287; c=relaxed/simple; bh=0UCm+FtEH1fDSmVI65wOBgX0TbP/hzUl+lCurkKSNfY=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=WQd0ZP2lpC5gJnSb+plaqO4DGnODMM46zCHMeyxUSHNGbMVFc8k4lLMRiW/O6VIgpIYgtqZGiMspt8XwWoW8oyL4mVxwYeVka+A4nUHc5KIBCv2XhK0AlOhOcEqI53bOWkvEOJ7whP3vudgx09HNAUcFSFgTcNbzh07IaJA9JGk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from ubuntu.localdomain (unknown [111.19.37.36]) by mail-m121144.qiye.163.com (Hmail) with ESMTPA id 39FB3AC005A; Fri, 5 Jan 2024 17:17:46 +0800 (CST) From: changjiachen To: binutils@sourceware.org Cc: xuchenghua@loongson.cn, chenglulu@loongson.cn, liuzhensong@loongson.cn, xry111@xry111.site, i.swmail@xen0n.name, maskray@google.com, cailulu@loongson.cn, luweining@loongson.cn, wanglei@loongson.cn, hejinyang@loongson.cn, Lazy_Linux@126.com, mengqinggang@loongson.cn, changjiachen Subject: [PATCH v1] LoongArch: ld: Adjusted some code order in relax.exp. Date: Fri, 5 Jan 2024 17:17:44 +0800 Message-Id: <20240105091744.125622-1-changjiachen@stu.xupt.edu.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVkZQksYVh1DShgaGE1PQ08dHlUTARMWGhIXJBQOD1 lXWRgSC1lBWUpKSlVKQlVITFVITVlXWRYaDxIVHRRZQVlPS0hVSkpLSEpDVUpLS1VLWQY+ X-HM-Tid: 0a8cd8ea0dbdb039kuuu39fb3ac005a X-HM-MType: 10 X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Kyo6FCo*MjweHD8iPiwRGAoh Sg4KFDBVSlVKTEtPT09NSU1MTUxMVTMWGhIXVRgTGhUcERIaGBMeFTsIDw5VAw4LD1UeHw5VGBVF WVdZEgtZQVlKSkpVSkJVSExVSE1ZV1kIAVlBSktCTkI3Bg++ X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, 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.30 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787241486684327916 X-GMAIL-MSGID: 1787241486684327916 ld/testsuite/ChangeLog: * ld/testsuite/ld-loongarch-elf/relax.exp: Modify test. --- ld/testsuite/ld-loongarch-elf/relax.exp | 290 ++++++++++++------------ 1 file changed, 145 insertions(+), 145 deletions(-) diff --git a/ld/testsuite/ld-loongarch-elf/relax.exp b/ld/testsuite/ld-loongarch-elf/relax.exp index b697d01563c..5da297533ac 100644 --- a/ld/testsuite/ld-loongarch-elf/relax.exp +++ b/ld/testsuite/ld-loongarch-elf/relax.exp @@ -33,90 +33,8 @@ if [istarget loongarch64-*-*] { "relax" \ ] \ ] - set tls_relax_builds [list \ - [list \ - "tls_relax_builds" \ - "" \ - "" \ - {relax-tls-le.s} \ - {} \ - "relax-tls-le" \ - ] \ - ] - set tls_no_relax_builds [list \ - [list \ - "tls_no_relax_builds" \ - "-Wl,--no-relax" \ - "" \ - {relax-tls-le.s} \ - {} \ - "no-relax-tls-le" \ - ] \ - ] - - set relax_bound_check [list \ - [list \ - "relax_bound_check" \ - "" \ - "" \ - {relax-bound-check-tls-le.s} \ - {} \ - "relax-bound-check-tls-le" \ - ] \ - ] - set no_relax_bound_check [list \ - [list \ - "no_relax_bound_check" \ - "-Wl,--no-relax" \ - "" \ - {relax-bound-check-tls-le.s} \ - {} \ - "no-relax-bound-check-tls-le" \ - ] \ - ] - - set old_tls_le [list \ - [list \ - "old_tls_le" \ - "" \ - "" \ - {old-tls-le.s} \ - {} \ - "old-tls-le" \ - ] \ - ] - - set relax_compatible [list \ - [list \ - "relax_compatible" \ - "" \ - "" \ - {tls-relax-compatible-check-new.s tls-relax-compatible-check-old.s} \ - {} \ - "realx-compatible" \ - ] \ - ] - - set no_relax_compatible [list \ - [list \ - "no_relax_compatible" \ - "-Wl,--no-relax" \ - "" \ - {tls-relax-compatible-check-new.s tls-relax-compatible-check-old.s} \ - {} \ - "no-realx-compatible" \ - ] \ - ] - run_cc_link_tests $pre_builds - run_cc_link_tests $tls_relax_builds - run_cc_link_tests $tls_no_relax_builds - run_cc_link_tests $relax_bound_check - run_cc_link_tests $no_relax_bound_check - run_cc_link_tests $old_tls_le - run_cc_link_tests $relax_compatible - run_cc_link_tests $no_relax_compatible if [file exist "tmpdir/relax"] { set objdump_output [run_host_cmd "objdump" "-d tmpdir/relax"] @@ -171,98 +89,180 @@ if [istarget loongarch64-*-*] { } } - # If symbol in data segment, offset need to sub segment align to prevent - # overflow. run_ld_link_tests \ [list \ [list \ - "loongarch relax segment alignment min" \ - "-e0 -Ttext 0x120004000 -pie -z relro" "" \ + "loongarch tls le relax .exe build" \ + "" "" \ "" \ - {relax-segment-min.s} \ + {relax-tls-le.s} \ {} \ - "relax-segment-min" \ + "relax-tls-le" \ ] \ ] + if [file exist "tmpdir/relax-tls-le"] { + set objdump_output1 [run_host_cmd "objdump" "-d tmpdir/relax-tls-le"] + if { [ regexp ".addi.*st.*" $objdump_output1] } { + pass "loongarch relax success" + } { + fail "loongarch relax fail" + } + } + run_ld_link_tests \ [list \ [list \ - "loongarch relax segment alignment max" \ - "-e0 -Ttext 0x120004000 -pie -z relro" "" \ + "loongarch tls le no relax .exe build" \ + "--no-relax" "" \ "" \ - {relax-segment-max.s} \ + {relax-tls-le.s} \ {} \ - "relax-segment-max" \ + "no-relax-tls-le" \ ] \ ] - if [file exist "tmpdir/relax-tls-le"] { - set objdump_output1 [run_host_cmd "objdump" "-d tmpdir/relax-tls-le"] - if { [ regexp ".addi.*st.*" $objdump_output1] } { - pass "loongarch relax success" - } { - fail "loongarch relax fail" - } - } - if [file exist "tmpdir/no-relax-tls-le"] { - set objdump_output2 [run_host_cmd "objdump" "-d tmpdir/no-relax-tls-le"] - if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output2] } { - pass "loongarch no-relax success" - } { - fail "loongarch no-relax fail" + if [file exist "tmpdir/no-relax-tls-le"] { + set objdump_output2 [run_host_cmd "objdump" "-d tmpdir/no-relax-tls-le"] + if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output2] } { + pass "loongarch no-relax success" + } { + fail "loongarch no-relax fail" + } } - } - if [file exist "tmpdir/old-tls-le"] { - set objdump_output3 [run_host_cmd "objdump" "-d tmpdir/old-tls-le"] - if { [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output3] } { - pass "loongarch old tls le success" - } { - fail "loongarch old tls le fail" + run_ld_link_tests \ + [list \ + [list \ + "loongarch old tls le .exe build" \ + "" "" \ + "" \ + {old-tls-le.s} \ + {} \ + "old-tls-le" \ + ] \ + ] + + if [file exist "tmpdir/old-tls-le"] { + set objdump_output3 [run_host_cmd "objdump" "-d tmpdir/old-tls-le"] + if { [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output3] } { + pass "loongarch old tls le success" + } { + fail "loongarch old tls le fail" + } } - } + run_ld_link_tests \ + [list \ + [list \ + "loongarch tls le realx compatible .exe build" \ + "" "" \ + "" \ + {tls-relax-compatible-check-new.s tls-relax-compatible-check-old.s} \ + {} \ + "realx-compatible" \ + ] \ + ] - if [file exist "tmpdir/realx-compatible"] { - set objdump_output4 [run_host_cmd "objdump" "-d tmpdir/realx-compatible"] - if { [ regexp ".addi.*st.*" $objdump_output4] && \ - [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output4] } { - pass "loongarch tls le relax compatible check success" - } { - fail "loongarch tls le relax compatible check fail" + if [file exist "tmpdir/realx-compatible"] { + set objdump_output4 [run_host_cmd "objdump" "-d tmpdir/realx-compatible"] + if { [ regexp ".addi.*st.*" $objdump_output4] && \ + [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output4] } { + pass "loongarch tls le relax compatible check success" + } { + fail "loongarch tls le relax compatible check fail" + } } - } - if [file exist "tmpdir/no-realx-compatible"] { - set objdump_output4 [run_host_cmd "objdump" "-d tmpdir/realx-compatible"] - if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output4] && \ - [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output4] } { - pass "loongarch tls le no-relax compatible check success" - } { - fail "loongarch tls le no-relax compatible check fail" + run_ld_link_tests \ + [list \ + [list \ + "loongarch tls le no realx compatible .exe build" \ + "--no-relax" "" \ + "" \ + {tls-relax-compatible-check-new.s tls-relax-compatible-check-old.s} \ + {} \ + "no-realx-compatible" \ + ] \ + ] + if [file exist "tmpdir/no-realx-compatible"] { + set objdump_output4 [run_host_cmd "objdump" "-d tmpdir/no-realx-compatible"] + if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output4] && \ + [ regexp ".*lu12i.*ori.*add.*addi.*stptr.*" $objdump_output4] } { + pass "loongarch tls le no-relax compatible check success" + } { + fail "loongarch tls le no-relax compatible check fail" + } } - } + run_ld_link_tests \ + [list \ + [list \ + "loongarch tls le realx bound-check .exe build" \ + "" "" \ + "" \ + {relax-bound-check-tls-le.s} \ + {} \ + "relax-bound-check-tls-le" \ + ] \ + ] - if [file exist "tmpdir/relax-bound-check-tls-le"] { - set objdump_output5 [run_host_cmd "objdump" "-d tmpdir/relax-bound-check-tls-le"] - if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output5] && \ - [ regexp ".addi.*st.*" $objdump_output5] } { - pass "loongarch no-relax success" - } { - fail "loongarch no-relax fail" + if [file exist "tmpdir/relax-bound-check-tls-le"] { + set objdump_output5 [run_host_cmd "objdump" "-d tmpdir/relax-bound-check-tls-le"] + if { [ regexp ".*lu12i.*add.*addi.*st.*" $objdump_output5] && \ + [ regexp ".addi.*st.*" $objdump_output5] } { + pass "loongarch no-relax success" + } { + fail "loongarch no-relax fail" + } } - } - if [file exist "tmpdir/no-relax-bound-check-tls-le"] { - set objdump_output5 [run_host_cmd "objdump" "-d tmpdir/no-relax-bound-check-tls-le"] - if { [ regexp ".*addi.*st.*" $objdump_output5] } { - pass "loongarch no-relax success" - } { - fail "loongarch no-relax fail" + run_ld_link_tests \ + [list \ + [list \ + "loongarch tls le no realx bound-check .exe build" \ + "--no-relax" "" \ + "" \ + {relax-bound-check-tls-le.s} \ + {} \ + "no-relax-bound-check-tls-le" \ + ] \ + ] + + if [file exist "tmpdir/no-relax-bound-check-tls-le"] { + set objdump_output5 [run_host_cmd "objdump" "-d tmpdir/no-relax-bound-check-tls-le"] + if { [ regexp ".*addi.*st.*" $objdump_output5] } { + pass "loongarch no-relax success" + } { + fail "loongarch no-relax fail" + } } - } + + # If symbol in data segment, offset need to sub segment align to prevent + # overflow. + run_ld_link_tests \ + [list \ + [list \ + "loongarch relax segment alignment min" \ + "-e0 -Ttext 0x120004000 -pie -z relro" "" \ + "" \ + {relax-segment-min.s} \ + {} \ + "relax-segment-min" \ + ] \ + ] + + run_ld_link_tests \ + [list \ + [list \ + "loongarch relax segment alignment max" \ + "-e0 -Ttext 0x120004000 -pie -z relro" "" \ + "" \ + {relax-segment-max.s} \ + {} \ + "relax-segment-max" \ + ] \ + ] } run_ld_link_tests \