From patchwork Sat Dec 16 04:01:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam James X-Patchwork-Id: 179796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp24346dyi; Fri, 15 Dec 2023 20:03:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEceF1rXfM2e5l2Lh7cjakdkyVnZNmw8wAoDND8s9tXfG0SAPsR8oOK3UNRgLgWwiDcuLEu X-Received: by 2002:a05:622a:148c:b0:423:a4f0:382 with SMTP id t12-20020a05622a148c00b00423a4f00382mr20375096qtx.21.1702699416360; Fri, 15 Dec 2023 20:03:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702699416; cv=pass; d=google.com; s=arc-20160816; b=Crlcn5Yuz0xVXGnRrjNed8wPM+w3fgmc1LNRs5WWSaff2R92OfiGBmHARzBvVmmKJV lKpdyLqPWkzGfI+m3gKbooEWY4o7N5vAWZAL9fDMSFGM0zd61VJzVi8YSXxzN98qcEZ1 AWcOZsfcnclk3fvLZCj3QzKMLs+neUoXMbJi3XXkQqVemtEr/N448rZ8YzTUaiMrFIcu lupqHtnwrERNTbafRP9bklxSaSTH4xvzCvxVqjg77UYNU7pslfW+TftZrj0bNDdkrr2v HhrUXkgWzg1BJwmvJI1eEj49yJMyBaD0L6927SOgFP/8KO4rTjpM7AURL8vzbUq97jZw RUAA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:arc-filter:dmarc-filter:delivered-to; bh=EbKBiFvdmUiz71wrEkpb6t9w2pjFr1aIaYz522d0HBg=; fh=xsOM88MzmEemLwX/Wnuw/FLLO3oL1Qpa4z+O9VYr3To=; b=PWAgkyJcIq8InpkeCpFMEWzzGub1TPDUfDgdahu0t58xWF0dKOJTurUuCEqlcY1iGu 63YIHPFysrmbyr2OvUGYwx9JrOjEHFc8lWnVK21p4w+pbHwBbbEdUxZly1fgYaNyJP/b hHifPtxVfkCXMV+ffO5H8/MYaiD+4nkuV9Hhhne+cnWptaPa5NbkA1sOkbjLP0L0C1J1 oDEqA2D9PODNhzi+XPP3xi7Rf8MUiPXak0KfCbIhhHQS1oFKkEF2b6vl1RkJ2QM7m2Gq mQ8WvNv+wteHBlL1vJ0JFXYWpbdxlW7iqxa1f9KQZdphZv7Jje6ITnLLjbK8Lbcfz+cz pUcw== 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 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gentoo.org Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id fw7-20020a05622a4a8700b00407dd1bbbf5si19843693qtb.368.2023.12.15.20.03.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 20:03:36 -0800 (PST) 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; arc=pass (i=1); 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gentoo.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E4D0B385803F for ; Sat, 16 Dec 2023 04:03:23 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 26D193857C77 for ; Sat, 16 Dec 2023 04:03:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 26D193857C77 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 26D193857C77 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.211.166.183 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702699382; cv=none; b=dCneW+S2lAB9AEYgiUQTQh9xeWlSxQACXBQPMOmrCzNfshuferZHRpkJEoNoU+Rz6yKSz+cf9vx2JsfsSmgL51HKG54nY/yYZnBxKNWUq/pHid3ymX8yZBMUBBCygymv2nAhln5CGRwTMmy3qcHZK+yVS4YvexTHgcRmLvtRBXo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702699382; c=relaxed/simple; bh=mw8C8sp7bUFQvOEdtTaMeOCHxr+uK5MCVP5NHMq0cWI=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=cpHv92R3PgszOVcYao87EhElAxdN1F+gKdDhJI7cBFE1b+QuYIUQcpa6BGkjzuhWwm9ETYHjl51yRsFet1NwtiAH9VF30Y/k1tqmTWdFLZ0uqeWqXlEI5i3Wk8zjevOnai5POCNUoETqK2XuHT4K16JQ1oATpK2AOJatYV4RtTo= ARC-Authentication-Results: i=1; server2.sourceware.org From: Sam James To: binutils@sourceware.org Cc: nickc@redhat.com, Jan Beulich Subject: [2.41 PATCH 08/10] ld/x86: reduce testsuite dependency on system object files Date: Sat, 16 Dec 2023 04:01:31 +0000 Message-ID: <20231216040239.1981071-9-sam@gentoo.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216040239.1981071-1-sam@gentoo.org> References: <20231216040239.1981071-1-sam@gentoo.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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.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: 1785409743219768394 X-GMAIL-MSGID: 1785409743219768394 From: Jan Beulich PR ld/30722 Tests looking for certain .note-section recorded properties may not involve object files from the underlying platform (e.g. via using the C compiler for linking): Such object files may themselves have similar note sections, and hence they may influence the overall outcome. For now convert just the tests known to be affected by crt*.o coming with "ISA v3 needed" notes. Eventually other tests ought to be converted, too. (cherry picked from commit eab996435fe65a421541f59557c5f1fd427573a3) --- ld/testsuite/ld-x86-64/property-stk.s | 25 +++ .../{property-x86-1.S => property-x86-1.s} | 15 +- .../{property-x86-2.S => property-x86-2.s} | 15 +- ld/testsuite/ld-x86-64/x86-64.exp | 170 +++++++++--------- 4 files changed, 131 insertions(+), 94 deletions(-) create mode 100644 ld/testsuite/ld-x86-64/property-stk.s rename ld/testsuite/ld-x86-64/{property-x86-1.S => property-x86-1.s} (75%) rename ld/testsuite/ld-x86-64/{property-x86-2.S => property-x86-2.s} (70%) diff --git a/ld/testsuite/ld-x86-64/property-stk.s b/ld/testsuite/ld-x86-64/property-stk.s new file mode 100644 index 00000000000..b3c7c4ee7af --- /dev/null +++ b/ld/testsuite/ld-x86-64/property-stk.s @@ -0,0 +1,25 @@ + .ifdef __64_bit__ + .equ ALIGN, 3 + .else + .equ ALIGN, 2 + .endif + + .section ".note.gnu.property", "a" + .p2align ALIGN + .long 1f - 0f /* name length. */ + .long 3f - 1f /* data length. */ + /* NT_GNU_PROPERTY_TYPE_0 */ + .long 5 /* note type. */ +0: + .asciz "GNU" /* vendor name. */ +1: + .p2align ALIGN + /* GNU_PROPERTY_STACK_SIZE */ + .long 1 /* pr_type. */ + .long 5f - 4f /* pr_datasz. */ +4: + .dc.a 0x800000 /* Stack size. */ +5: + .p2align ALIGN +3: + .section .note.GNU-stack diff --git a/ld/testsuite/ld-x86-64/property-x86-1.S b/ld/testsuite/ld-x86-64/property-x86-1.s similarity index 75% rename from ld/testsuite/ld-x86-64/property-x86-1.S rename to ld/testsuite/ld-x86-64/property-x86-1.s index 6d1d8fbaef5..3e3f707bacc 100644 --- a/ld/testsuite/ld-x86-64/property-x86-1.S +++ b/ld/testsuite/ld-x86-64/property-x86-1.s @@ -1,8 +1,9 @@ -#ifdef __LP64__ -# define ALIGN 3 -#else -# define ALIGN 2 -#endif + .ifdef __64_bit__ + .equ ALIGN, 3 + .else + .equ ALIGN, 2 + .endif + .section ".note.gnu.property", "a" .p2align ALIGN .long 1f - 0f /* name length. */ @@ -24,14 +25,14 @@ .long 0xc0010002 /* pr_type. */ .long 5f - 4f /* pr_datasz. */ 4: - .long 0xa + .long 0xa /* GNU_PROPERTY_X86_ISA_1_V2 | GNU_PROPERTY_X86_ISA_1_V4 */ 5: .p2align ALIGN /* GNU_PROPERTY_X86_ISA_1_NEEDED */ .long 0xc0008002 /* pr_type. */ .long 5f - 4f /* pr_datasz. */ 4: - .long 0x3 + .long 0x3 /* GNU_PROPERTY_X86_ISA_1_BASELINE | GNU_PROPERTY_X86_ISA_1_V2 */ 5: .p2align ALIGN 3: diff --git a/ld/testsuite/ld-x86-64/property-x86-2.S b/ld/testsuite/ld-x86-64/property-x86-2.s similarity index 70% rename from ld/testsuite/ld-x86-64/property-x86-2.S rename to ld/testsuite/ld-x86-64/property-x86-2.s index 613d5b21ce7..2c3b303f7ee 100644 --- a/ld/testsuite/ld-x86-64/property-x86-2.S +++ b/ld/testsuite/ld-x86-64/property-x86-2.s @@ -1,8 +1,9 @@ -#ifdef __LP64__ -# define ALIGN 3 -#else -# define ALIGN 2 -#endif + .ifdef __64_bit__ + .equ ALIGN, 3 + .else + .equ ALIGN, 2 + .endif + .section ".note.gnu.property", "a" .p2align ALIGN .long 1f - 0f /* name length. */ @@ -17,14 +18,14 @@ .long 0xc0010002 /* pr_type. */ .long 5f - 4f /* pr_datasz. */ 4: - .long 0x3 + .long 0x3 /* GNU_PROPERTY_X86_ISA_1_BASELINE | GNU_PROPERTY_X86_ISA_1_V2 */ 5: .p2align ALIGN /* GNU_PROPERTY_X86_ISA_1_NEEDED */ .long 0xc0008002 /* pr_type. */ .long 5f - 4f /* pr_datasz. */ 4: - .long 0xa + .long 0xa /* GNU_PROPERTY_X86_ISA_1_V2 | GNU_PROPERTY_X86_ISA_1_V4 */ 5: .p2align ALIGN 3: diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 1a10c395b5c..123152df5b0 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -1091,86 +1091,6 @@ if { [isnative] && [check_compiler_available] } { {{readelf {-n} property-2.r}} \ "property-2.so" \ ] \ - [list \ - "Build property 3" \ - "" \ - "-Wa,-mx86-used-note=yes" \ - {pass.c property-stack.S property-x86-1.S} \ - {{readelf {-n} property-3.r}} \ - "property-3" \ - ] \ - [list \ - "Build property 3 (.o)" \ - "-r -nostdlib" \ - "-Wa,-mx86-used-note=yes" \ - {pass.c property-x86-1.S property-stack.S} \ - {{readelf {-n} property-3a.r}} \ - "property-3.o" \ - ] \ - [list \ - "Build property 3 (.so)" \ - "-shared" \ - "-fPIC -Wa,-mx86-used-note=yes" \ - {property-x86-1.S pass.c property-stack.S} \ - {{readelf {-n} property-3.r}} \ - "property-3.so" \ - ] \ - [list \ - "Build property 4" \ - "" \ - "-Wa,-mx86-used-note=yes" \ - {pass.c property-stack.S property-x86-1.S property-x86-2.S} \ - {{readelf {-n} property-4.r}} \ - "property-4" \ - ] \ - [list \ - "Build property 4 (.o)" \ - "-r -nostdlib" \ - "-Wa,-mx86-used-note=yes" \ - {pass.c property-x86-2.S property-x86-1.S property-stack.S} \ - {{readelf {-n} property-4a.r}} \ - "property-4.o" \ - ] \ - [list \ - "Build property 4 (.so)" \ - "-shared" \ - "-fPIC -Wa,-mx86-used-note=yes" \ - {property-x86-2.S property-x86-1.S pass.c property-stack.S} \ - {{readelf {-n} property-4.r}} \ - "property-4.so" \ - ] \ - [list \ - "Build property 4 (-Wl,-z,stack-size=0)" \ - "-Wl,-z,stack-size=0" \ - "-Wa,-mx86-used-note=yes" \ - {pass.c property-stack.S property-x86-1.S property-x86-2.S} \ - {{readelf {-n} property-4.r}} \ - "property-4" \ - ] \ - [list \ - "Build property 5" \ - "-Wl,-z,stack-size=0x900000" \ - "-Wa,-mx86-used-note=yes" \ - {pass.c property-stack.S property-x86-1.S property-x86-2.S} \ - {{readelf {-n} property-5.r}} \ - "property-5" \ - ] \ - [list \ - "Build property 5 (.o)" \ - "-r -nostdlib -Wl,-z,stack-size=0x900000" \ - "-Wa,-mx86-used-note=yes" \ - {pass.c property-x86-2.S property-x86-1.S property-stack.S} \ - {{readelf {-n} property-5a.r}} \ - "property-5.o" \ - ] \ - [list \ - "Build property 5 (.so)" \ - "-shared -Wl,-z,stack-size=0x900000" \ - "-fPIC -Wa,-mx86-used-note=yes" \ - {property-x86-2.S property-x86-1.S pass.c property-stack.S} \ - {{readelf {-n} property-5.r}} \ - "property-5.so" \ - ] \ [list \ "Build property-6.so" \ "-shared" \ @@ -2178,6 +2098,96 @@ run_ld_link_tests [list \ {{readelf -SW plt2.rd} {objdump -dwr plt2.dd}} \ "plt2" \ ] \ + [list \ + "Build property 3" \ + "" \ + "" \ + "--64 -defsym __64_bit__=1 -mx86-used-note=yes" \ + {property-stk.s property-x86-1.s} \ + {{readelf -n property-3.r}} \ + "property-3" \ + ] \ + [list \ + "Build property 3 (.o)" \ + "-r -nostdlib" \ + "" \ + "--64 -defsym __64_bit__=1 -mx86-used-note=yes" \ + {property-x86-1.s property-stk.s} \ + {{readelf -n property-3a.r}} \ + "property-3.o" \ + ] \ + [list \ + "Build property 3 (.so)" \ + "-shared" \ + "" \ + "--64 -defsym __64_bit__=1 -mx86-used-note=yes" \ + {property-x86-1.s property-stk.s} \ + {{readelf -n property-3.r}} \ + "property-3.so" \ + ] \ + [list \ + "Build property 4" \ + "" \ + "" \ + "--64 -defsym __64_bit__=1 -mx86-used-note=yes" \ + {property-stk.s property-x86-1.s property-x86-2.s} \ + {{readelf -n property-4.r}} \ + "property-4" \ + ] \ + [list \ + "Build property 4 (.o)" \ + "-r -nostdlib" \ + "" \ + "--64 -defsym __64_bit__=1 -mx86-used-note=yes" \ + {property-x86-2.s property-x86-1.s property-stk.s} \ + {{readelf {-n} property-4a.r}} \ + "property-4.o" \ + ] \ + [list \ + "Build property 4 (.so)" \ + "-shared" \ + "" \ + "--64 -defsym __64_bit__=1 -mx86-used-note=yes" \ + {property-x86-2.s property-x86-1.s property-stk.s} \ + {{readelf -n property-4.r}} \ + "property-4.so" \ + ] \ + [list \ + "Build property 4 (-z stack-size=0)" \ + "-z stack-size=0" \ + "" \ + "--64 -defsym __64_bit__=1 -mx86-used-note=yes" \ + {property-stk.s property-x86-1.s property-x86-2.s} \ + {{readelf -n property-4.r}} \ + "property-4" \ + ] \ + [list \ + "Build property 5" \ + "-z stack-size=0x900000" \ + "" \ + "--64 -defsym __64_bit__=1 -mx86-used-note=yes" \ + {property-stk.s property-x86-1.s property-x86-2.s} \ + {{readelf -n property-5.r}} \ + "property-5" \ + ] \ + [list \ + "Build property 5 (.o)" \ + "-r -nostdlib -z stack-size=0x900000" \ + "" \ + "--64 -defsym __64_bit__=1 -mx86-used-note=yes" \ + {property-x86-2.s property-x86-1.s property-stk.s} \ + {{readelf {-n} property-5a.r}} \ + "property-5.o" \ + ] \ + [list \ + "Build property 5 (.so)" \ + "-shared -z stack-size=0x900000" \ + "" \ + "--64 -defsym __64_bit__=1 -mx86-used-note=yes" \ + {property-x86-2.s property-x86-1.s property-stk.s} \ + {{readelf -n property-5.r}} \ + "property-5.so" \ + ] \ [list \ "Build pr21626.so" \ "-shared -melf_x86_64" \