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: 83385 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 4F3E23857400 for ; Fri, 5 Jan 2024 09:18:53 +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+patchwork=sourceware.org@sourceware.org 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 \