| ... | @@ -20,16 +20,11 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -20,16 +20,11 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 20 | .os_tag = .linux, | 20 | .os_tag = .linux, |
| 21 | .abi = .gnu, | 21 | .abi = .gnu, |
| 22 | }); | 22 | }); |
| 23 | // const aarch64_musl = b.resolveTargetQuery(.{ | 23 | const aarch64_musl = b.resolveTargetQuery(.{ |
| 24 | // .cpu_arch = .aarch64, | 24 | .cpu_arch = .aarch64, |
| 25 | // .os_tag = .linux, | 25 | .os_tag = .linux, |
| 26 | // .abi = .musl, | 26 | .abi = .musl, |
| 27 | // }); | 27 | }); |
| 28 | // const aarch64_gnu = b.resolveTargetQuery(.{ | | |
| 29 | // .cpu_arch = .aarch64, | | |
| 30 | // .os_tag = .linux, | | |
| 31 | // .abi = .gnu, | | |
| 32 | // }); | | |
| 33 | const riscv64_musl = b.resolveTargetQuery(.{ | 28 | const riscv64_musl = b.resolveTargetQuery(.{ |
| 34 | .cpu_arch = .riscv64, | 29 | .cpu_arch = .riscv64, |
| 35 | .os_tag = .linux, | 30 | .os_tag = .linux, |
| ... | @@ -153,6 +148,9 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { | ... | @@ -153,6 +148,9 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step { |
| 153 | elf_step.dependOn(testMismatchedCpuArchitectureError(b, .{ .target = x86_64_musl })); | 148 | elf_step.dependOn(testMismatchedCpuArchitectureError(b, .{ .target = x86_64_musl })); |
| 154 | elf_step.dependOn(testZText(b, .{ .target = x86_64_gnu })); | 149 | elf_step.dependOn(testZText(b, .{ .target = x86_64_gnu })); |
| 155 | | 150 | |
| | 151 | // aarch64 specific tests |
| | 152 | elf_step.dependOn(testThunks(b, .{ .target = aarch64_musl })); |
| | 153 | |
| 156 | // x86_64 self-hosted backend | 154 | // x86_64 self-hosted backend |
| 157 | elf_step.dependOn(testEmitRelocatable(b, .{ .use_llvm = false, .target = x86_64_musl })); | 155 | elf_step.dependOn(testEmitRelocatable(b, .{ .use_llvm = false, .target = x86_64_musl })); |
| 158 | elf_step.dependOn(testEmitStaticLibZig(b, .{ .use_llvm = false, .target = x86_64_musl })); | 156 | elf_step.dependOn(testEmitStaticLibZig(b, .{ .use_llvm = false, .target = x86_64_musl })); |
| ... | @@ -2670,6 +2668,43 @@ fn testStrip(b: *Build, opts: Options) *Step { | ... | @@ -2670,6 +2668,43 @@ fn testStrip(b: *Build, opts: Options) *Step { |
| 2670 | return test_step; | 2668 | return test_step; |
| 2671 | } | 2669 | } |
| 2672 | | 2670 | |
| | 2671 | fn testThunks(b: *Build, opts: Options) *Step { |
| | 2672 | const test_step = addTestStep(b, "thunks", opts); |
| | 2673 | |
| | 2674 | const exe = addExecutable(b, opts, .{ .name = "main", .c_source_bytes = |
| | 2675 | \\#include <stdio.h> |
| | 2676 | \\__attribute__((aligned(0x8000000))) int bar() { |
| | 2677 | \\ return 42; |
| | 2678 | \\} |
| | 2679 | \\int foobar(); |
| | 2680 | \\int foo() { |
| | 2681 | \\ return bar() - foobar(); |
| | 2682 | \\} |
| | 2683 | \\__attribute__((aligned(0x8000000))) int foobar() { |
| | 2684 | \\ return 42; |
| | 2685 | \\} |
| | 2686 | \\int main() { |
| | 2687 | \\ printf("bar=%d, foo=%d, foobar=%d", bar(), foo(), foobar()); |
| | 2688 | \\ return foo(); |
| | 2689 | \\} |
| | 2690 | }); |
| | 2691 | exe.link_function_sections = true; |
| | 2692 | exe.linkLibC(); |
| | 2693 | |
| | 2694 | const run = addRunArtifact(exe); |
| | 2695 | run.expectStdOutEqual("bar=42, foo=0, foobar=42"); |
| | 2696 | run.expectExitCode(0); |
| | 2697 | test_step.dependOn(&run.step); |
| | 2698 | |
| | 2699 | const check = exe.checkObject(); |
| | 2700 | check.max_bytes = std.math.maxInt(u32); |
| | 2701 | check.checkInSymtab(); |
| | 2702 | check.checkContains("_libc_start_main$thunk"); |
| | 2703 | test_step.dependOn(&check.step); |
| | 2704 | |
| | 2705 | return test_step; |
| | 2706 | } |
| | 2707 | |
| 2673 | fn testTlsDfStaticTls(b: *Build, opts: Options) *Step { | 2708 | fn testTlsDfStaticTls(b: *Build, opts: Options) *Step { |
| 2674 | const test_step = addTestStep(b, "tls-df-static-tls", opts); | 2709 | const test_step = addTestStep(b, "tls-df-static-tls", opts); |
| 2675 | | 2710 | |