From: Sam James <sam@gentoo.org>
To: binutils@sourceware.org
Cc: nickc@redhat.com, Jan Beulich <jbeulich@suse.com>
Subject: [2.41 PATCH 08/10] ld/x86: reduce testsuite dependency on system object files
Date: Sat, 16 Dec 2023 04:01:31 +0000 [thread overview]
Message-ID: <20231216040239.1981071-9-sam@gentoo.org> (raw)
In-Reply-To: <20231216040239.1981071-1-sam@gentoo.org>
From: Jan Beulich <jbeulich@suse.com>
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" \
--
2.43.0
next prev parent reply other threads:[~2023-12-16 4:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-16 4:01 [2.41 PATCH 00/10] Misc binutils-2.41 test fixes Sam James
2023-12-16 4:01 ` [2.41 PATCH 01/10] gprofng: 30700 tmpdir/gp-collect-app_F test fails Sam James
2023-12-16 4:01 ` [2.41 PATCH 02/10] Fix "--only-keep-debug for ELF relocatables" binutils test for compilers which add .debug_macro sections to object files Sam James
2023-12-16 4:01 ` [2.41 PATCH 03/10] ld: Build libpr23169a.so with -z lazy Sam James
2023-12-16 4:01 ` [2.41 PATCH 04/10] ld: Fix relocatable.d XFAIL/notarget entry for hppa Sam James
2023-12-16 4:01 ` [2.41 PATCH 05/10] ld: Fix retain7a.d " Sam James
2023-12-16 4:01 ` [2.41 PATCH 06/10] ld: fix relocatable, retain7a target pattens for HPPA Sam James
2023-12-16 4:01 ` [2.41 PATCH 07/10] ld: ld-lib.exp: log failed dump.out contents for debugging Sam James
2023-12-16 4:01 ` Sam James [this message]
2023-12-16 4:01 ` [2.41 PATCH 09/10] Fix ld/x86: reduce testsuite dependency on system object files Sam James
2023-12-16 4:01 ` [2.41 PATCH 10/10] Fix 30808 gprofng tests failed Sam James
2023-12-20 10:59 ` [2.41 PATCH 00/10] Misc binutils-2.41 test fixes Sam James
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231216040239.1981071-9-sam@gentoo.org \
--to=sam@gentoo.org \
--cc=binutils@sourceware.org \
--cc=jbeulich@suse.com \
--cc=nickc@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).