diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2024-01-15 07:37:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-15 07:37:09 +0100 |
| commit | 3dddb881bfefbcd64aae7775ed72c42e37503674 (patch) | |
| tree | d3a8523750581848381b796a3de59fc05b66c64f /test | |
| parent | 852e7e24b5f15b489463bdabb0039e2a424e5ee6 (diff) | |
| parent | b1ffc2b8b353f64362c27df2ecc44436db234a29 (diff) | |
| download | zig-3dddb881bfefbcd64aae7775ed72c42e37503674.tar.gz zig-3dddb881bfefbcd64aae7775ed72c42e37503674.zip | |
Merge pull request #18560 from ziglang/elf-report-dupes
elf: report duplicate symbol definitions
Diffstat (limited to 'test')
| -rw-r--r-- | test/link/elf.zig | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/test/link/elf.zig b/test/link/elf.zig index 92aba4f352..0d76a5b64b 100644 --- a/test/link/elf.zig +++ b/test/link/elf.zig @@ -695,41 +695,41 @@ fn testDsoUndef(b: *Build, opts: Options) *Step { fn testEmitRelocatable(b: *Build, opts: Options) *Step { const test_step = addTestStep(b, "emit-relocatable", opts); - const obj1 = addObject(b, opts, .{ - .name = "obj1", - .zig_source_bytes = - \\const std = @import("std"); - \\extern var bar: i32; - \\export fn foo() i32 { - \\ return bar; - \\} - \\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); - \\} - , + const a_o = addObject(b, opts, .{ .name = "a", .zig_source_bytes = + \\const std = @import("std"); + \\extern var bar: i32; + \\export fn foo() i32 { + \\ return bar; + \\} + \\export fn printFoo() void { + \\ std.debug.print("foo={d}\n", .{foo()}); + \\} }); - obj1.linkLibC(); + a_o.linkLibC(); - 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(); - \\} - , + const b_o = addObject(b, opts, .{ .name = "b", .c_source_bytes = + \\#include <stdio.h> + \\int bar = 42; + \\void printBar() { + \\ fprintf(stderr, "bar=%d\n", bar); + \\} }); - 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(); const run = addRunArtifact(exe); |
