| ... | @@ -695,41 +695,40 @@ fn testDsoUndef(b: *Build, opts: Options) *Step { | ... | @@ -695,41 +695,40 @@ fn testDsoUndef(b: *Build, opts: Options) *Step { |
| 695 | fn testEmitRelocatable(b: *Build, opts: Options) *Step { | 695 | fn testEmitRelocatable(b: *Build, opts: Options) *Step { |
| 696 | const test_step = addTestStep(b, "emit-relocatable", opts); | 696 | const test_step = addTestStep(b, "emit-relocatable", opts); |
| 697 | | 697 | |
| 698 | const obj1 = addObject(b, opts, .{ | 698 | const a_o = addObject(b, opts, .{ .name = "a", .zig_source_bytes = |
| 699 | .name = "obj1", | 699 | \\const std = @import("std"); |
| 700 | .zig_source_bytes = | 700 | \\extern var bar: i32; |
| 701 | \\const std = @import("std"); | 701 | \\export fn foo() i32 { |
| 702 | \\extern var bar: i32; | 702 | \\ return bar; |
| 703 | \\export fn foo() i32 { | 703 | \\} |
| 704 | \\ return bar; | 704 | \\export fn printFoo() void { |
| 705 | \\} | 705 | \\ std.debug.print("foo={d}\n", .{foo()}); |
| 706 | \\export fn printFoo() void { | 706 | \\} |
| 707 | \\ std.debug.print("foo={d}\n", .{foo()}); | 707 | }); |
| 708 | \\} | 708 | |
| 709 | , | 709 | const b_o = addObject(b, opts, .{ .name = "b", .c_source_bytes = |
| 710 | .c_source_bytes = | 710 | \\#include <stdio.h> |
| 711 | \\#include <stdio.h> | 711 | \\int bar = 42; |
| 712 | \\int bar = 42; | 712 | \\void printBar() { |
| 713 | \\void printBar() { | 713 | \\ fprintf(stderr, "bar=%d\n", bar); |
| 714 | \\ fprintf(stderr, "bar=%d\n", bar); | 714 | \\} |
| 715 | \\} | | |
| 716 | , | | |
| 717 | }); | 715 | }); |
| 718 | obj1.linkLibC(); | 716 | b_o.linkLibC(); |
| 719 | | 717 | |
| 720 | const exe = addExecutable(b, opts, .{ | 718 | const c_o = addObject(b, opts, .{ .name = "c" }); |
| 721 | .name = "test", | 719 | c_o.addObject(a_o); |
| 722 | .zig_source_bytes = | 720 | c_o.addObject(b_o); |
| 723 | \\const std = @import("std"); | 721 | |
| 724 | \\extern fn printFoo() void; | 722 | const exe = addExecutable(b, opts, .{ .name = "test", .zig_source_bytes = |
| 725 | \\extern fn printBar() void; | 723 | \\const std = @import("std"); |
| 726 | \\pub fn main() void { | 724 | \\extern fn printFoo() void; |
| 727 | \\ printFoo(); | 725 | \\extern fn printBar() void; |
| 728 | \\ printBar(); | 726 | \\pub fn main() void { |
| 729 | \\} | 727 | \\ printFoo(); |
| 730 | , | 728 | \\ printBar(); |
| | 729 | \\} |
| 731 | }); | 730 | }); |
| 732 | exe.addObject(obj1); | 731 | exe.addObject(c_o); |
| 733 | exe.linkLibC(); | 732 | exe.linkLibC(); |
| 734 | | 733 | |
| 735 | const run = addRunArtifact(exe); | 734 | const run = addRunArtifact(exe); |