aboutsummaryrefslogtreecommitdiff
path: root/test/link/elf.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-10-21 21:05:46 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-10-23 16:27:39 -0700
commitf2efe051558cb7cfac6f489eb4e3adbfcbb44e4f (patch)
tree59c090aab5e61fb4ed8dd9597db517428b881c55 /test/link/elf.zig
parent3deb9ab30abcc418758b0365d2c0596a610555b4 (diff)
downloadzig-f2efe051558cb7cfac6f489eb4e3adbfcbb44e4f.tar.gz
zig-f2efe051558cb7cfac6f489eb4e3adbfcbb44e4f.zip
use deterministic order in relocatable-eh-frame tests
This test does not pass in master branch either if you flip the object order around.
Diffstat (limited to 'test/link/elf.zig')
-rw-r--r--test/link/elf.zig41
1 files changed, 32 insertions, 9 deletions
diff --git a/test/link/elf.zig b/test/link/elf.zig
index 9a324c0502..8af1dff695 100644
--- a/test/link/elf.zig
+++ b/test/link/elf.zig
@@ -2724,7 +2724,7 @@ fn testRelocatableArchive(b: *Build, opts: Options) *Step {
fn testRelocatableEhFrame(b: *Build, opts: Options) *Step {
const test_step = addTestStep(b, "relocatable-eh-frame", opts);
- const obj = addObject(b, opts, .{
+ const obj1 = addObject(b, opts, .{
.name = "obj1",
.cpp_source_bytes =
\\#include <stdexcept>
@@ -2733,12 +2733,21 @@ fn testRelocatableEhFrame(b: *Build, opts: Options) *Step {
\\}
,
});
- addCppSourceBytes(obj,
+ obj1.linkLibCpp();
+ const obj2 = addObject(b, opts, .{
+ .name = "obj2",
+ .cpp_source_bytes =
\\extern int try_me();
\\int try_again() {
\\ return try_me();
\\}
- , &.{});
+ ,
+ });
+ obj2.linkLibCpp();
+
+ const obj = addObject(b, opts, .{ .name = "obj" });
+ obj.addObject(obj1);
+ obj.addObject(obj2);
obj.linkLibCpp();
const exe = addExecutable(b, opts, .{ .name = "test1" });
@@ -2768,8 +2777,8 @@ fn testRelocatableEhFrame(b: *Build, opts: Options) *Step {
fn testRelocatableEhFrameComdatHeavy(b: *Build, opts: Options) *Step {
const test_step = addTestStep(b, "relocatable-eh-frame-comdat-heavy", opts);
- const obj = addObject(b, opts, .{
- .name = "obj2",
+ const obj1 = addObject(b, opts, .{
+ .name = "obj1",
.cpp_source_bytes =
\\#include <stdexcept>
\\int try_me() {
@@ -2777,13 +2786,20 @@ fn testRelocatableEhFrameComdatHeavy(b: *Build, opts: Options) *Step {
\\}
,
});
- addCppSourceBytes(obj,
+ obj1.linkLibCpp();
+ const obj2 = addObject(b, opts, .{
+ .name = "obj2",
+ .cpp_source_bytes =
\\extern int try_me();
\\int try_again() {
\\ return try_me();
\\}
- , &.{});
- addCppSourceBytes(obj,
+ ,
+ });
+ obj2.linkLibCpp();
+ const obj3 = addObject(b, opts, .{
+ .name = "obj3",
+ .cpp_source_bytes =
\\#include <iostream>
\\#include <stdexcept>
\\extern int try_again();
@@ -2795,7 +2811,14 @@ fn testRelocatableEhFrameComdatHeavy(b: *Build, opts: Options) *Step {
\\ }
\\ return 0;
\\}
- , &.{});
+ ,
+ });
+ obj3.linkLibCpp();
+
+ const obj = addObject(b, opts, .{ .name = "obj" });
+ obj.addObject(obj1);
+ obj.addObject(obj2);
+ obj.addObject(obj3);
obj.linkLibCpp();
const exe = addExecutable(b, opts, .{ .name = "test2" });