mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
test/link/elf: trigger build system bug testing relocatable mode
This commit is contained in:
parent
7a96907b92
commit
d7c2324cdb
1 changed files with 31 additions and 32 deletions
|
|
@ -695,41 +695,40 @@ fn testDsoUndef(b: *Build, opts: Options) *Step {
|
||||||
fn testEmitRelocatable(b: *Build, opts: Options) *Step {
|
fn testEmitRelocatable(b: *Build, opts: Options) *Step {
|
||||||
const test_step = addTestStep(b, "emit-relocatable", opts);
|
const test_step = addTestStep(b, "emit-relocatable", opts);
|
||||||
|
|
||||||
const obj1 = addObject(b, opts, .{
|
const a_o = addObject(b, opts, .{ .name = "a", .zig_source_bytes =
|
||||||
.name = "obj1",
|
\\const std = @import("std");
|
||||||
.zig_source_bytes =
|
\\extern var bar: i32;
|
||||||
\\const std = @import("std");
|
\\export fn foo() i32 {
|
||||||
\\extern var bar: i32;
|
\\ return bar;
|
||||||
\\export fn foo() i32 {
|
\\}
|
||||||
\\ return bar;
|
\\export fn printFoo() void {
|
||||||
\\}
|
\\ std.debug.print("foo={d}\n", .{foo()});
|
||||||
\\export fn printFoo() void {
|
\\}
|
||||||
\\ std.debug.print("foo={d}\n", .{foo()});
|
|
||||||
\\}
|
|
||||||
,
|
|
||||||
.c_source_bytes =
|
|
||||||
\\#include <stdio.h>
|
|
||||||
\\int bar = 42;
|
|
||||||
\\void printBar() {
|
|
||||||
\\ fprintf(stderr, "bar=%d\n", bar);
|
|
||||||
\\}
|
|
||||||
,
|
|
||||||
});
|
});
|
||||||
obj1.linkLibC();
|
|
||||||
|
|
||||||
const exe = addExecutable(b, opts, .{
|
const b_o = addObject(b, opts, .{ .name = "b", .c_source_bytes =
|
||||||
.name = "test",
|
\\#include <stdio.h>
|
||||||
.zig_source_bytes =
|
\\int bar = 42;
|
||||||
\\const std = @import("std");
|
\\void printBar() {
|
||||||
\\extern fn printFoo() void;
|
\\ fprintf(stderr, "bar=%d\n", bar);
|
||||||
\\extern fn printBar() void;
|
\\}
|
||||||
\\pub fn main() void {
|
|
||||||
\\ printFoo();
|
|
||||||
\\ printBar();
|
|
||||||
\\}
|
|
||||||
,
|
|
||||||
});
|
});
|
||||||
exe.addObject(obj1);
|
b_o.linkLibC();
|
||||||
|
|
||||||
|
const c_o = addObject(b, opts, .{ .name = "c" });
|
||||||
|
c_o.addObject(a_o);
|
||||||
|
c_o.addObject(b_o);
|
||||||
|
|
||||||
|
const exe = addExecutable(b, opts, .{ .name = "test", .zig_source_bytes =
|
||||||
|
\\const std = @import("std");
|
||||||
|
\\extern fn printFoo() void;
|
||||||
|
\\extern fn printBar() void;
|
||||||
|
\\pub fn main() void {
|
||||||
|
\\ printFoo();
|
||||||
|
\\ printBar();
|
||||||
|
\\}
|
||||||
|
});
|
||||||
|
exe.addObject(c_o);
|
||||||
exe.linkLibC();
|
exe.linkLibC();
|
||||||
|
|
||||||
const run = addRunArtifact(exe);
|
const run = addRunArtifact(exe);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue