| ... | @@ -2973,44 +2973,27 @@ fn testStrip(b: *Build, opts: Options) *Step { | ... | @@ -2973,44 +2973,27 @@ fn testStrip(b: *Build, opts: Options) *Step { |
| 2973 | fn testThunks(b: *Build, opts: Options) *Step { | 2973 | fn testThunks(b: *Build, opts: Options) *Step { |
| 2974 | const test_step = addTestStep(b, "thunks", opts); | 2974 | const test_step = addTestStep(b, "thunks", opts); |
| 2975 | | 2975 | |
| 2976 | const src = | 2976 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = |
| 2977 | \\#include <stdio.h> | 2977 | \\void foo(); |
| 2978 | \\__attribute__((aligned(0x8000000))) int bar() { | 2978 | \\__attribute__((section(".bar"))) void bar() { |
| 2979 | \\ return 42; | 2979 | \\ return foo(); |
| 2980 | \\} | 2980 | \\} |
| 2981 | \\int foobar(); | 2981 | \\__attribute__((section(".foo"))) void foo() { |
| 2982 | \\int foo() { | 2982 | \\ return bar(); |
| 2983 | \\ return bar() - foobar(); | 2983 | \\} |
| 2984 | \\} | 2984 | \\int main() { |
| 2985 | \\__attribute__((aligned(0x8000000))) int foobar() { | 2985 | \\ foo(); |
| 2986 | \\ return 42; | 2986 | \\ bar(); |
| 2987 | \\} | 2987 | \\ return 0; |
| 2988 | \\int main() { | 2988 | \\} |
| 2989 | \\ printf("bar=%d, foo=%d, foobar=%d", bar(), foo(), foobar()); | 2989 | }); |
| 2990 | \\ return foo(); | | |
| 2991 | \\} | | |
| 2992 | ; | | |
| 2993 | | | |
| 2994 | { | | |
| 2995 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = src }); | | |
| 2996 | exe.link_function_sections = true; | | |
| 2997 | exe.linkLibC(); | | |
| 2998 | | | |
| 2999 | const run = addRunArtifact(exe); | | |
| 3000 | run.expectStdOutEqual("bar=42, foo=0, foobar=42"); | | |
| 3001 | run.expectExitCode(0); | | |
| 3002 | test_step.dependOn(&run.step); | | |
| 3003 | } | | |
| 3004 | | | |
| 3005 | { | | |
| 3006 | const exe = addExecutable(b, opts, .{ .name = "main2", .c_source_bytes = src }); | | |
| 3007 | exe.linkLibC(); | | |
| 3008 | | 2990 | |
| 3009 | const run = addRunArtifact(exe); | 2991 | const check = exe.checkObject(); |
| 3010 | run.expectStdOutEqual("bar=42, foo=0, foobar=42"); | 2992 | check.checkInSymtab(); |
| 3011 | run.expectExitCode(0); | 2993 | check.checkContains("foo$thunk"); |
| 3012 | test_step.dependOn(&run.step); | 2994 | check.checkInSymtab(); |
| 3013 | } | 2995 | check.checkContains("bar$thunk"); |
| | 2996 | test_step.dependOn(&check.step); |
| 3014 | | 2997 | |
| 3015 | return test_step; | 2998 | return test_step; |
| 3016 | } | 2999 | } |