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