mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-26 13:01:34 +03:00
e7d74e49b0
The active contributors and maintainers of Zig's linker code have generally found the current linker test harness to be cumbersome. The tests require a lot of maintenance, but do not provide a lot of coverage, and when they fail it is painful to troubleshoot. Furthermore, as part of working on #31691, I don't want to port over the CheckObject step, because I don't like the code anyway. The plan forward is to start enhancing `zig objdump` to assist in linker development, as well as using it as the basis for snapshot testing. We absolutely need linker test coverage, but we need to try to improve these things about the next attempt: * less effort to create and maintain tests * less CPU overhead - we should be able to add a lot of tests without adding a lot of CI time. * more helpful failures. A failed linker test should provide the next steps a developer can take to understand why the test failed. * a goal of porting over all of LLD's test suite, or at least the good ones. I'm not going to open an issue to track the lost linker test coverage, because there was already so much lack of coverage for linker stuff. However I will open issues to track this lost coverage: * the deleted checks from test/standalone/glibc_compat/build.zig * the deleted checks from test/standalone/compiler_rt_panic/build.zig * the deleted checks from test/standalone/ios/build.zig
41 lines
1.3 KiB
Zig
41 lines
1.3 KiB
Zig
const std = @import("std");
|
|
|
|
pub const requires_symlinks = true;
|
|
pub const requires_ios_sdk = true;
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const test_step = b.step("test", "Test it");
|
|
b.default_step = test_step;
|
|
|
|
const optimize: std.builtin.OptimizeMode = .Debug;
|
|
const target = b.resolveTargetQuery(.{
|
|
.cpu_arch = .aarch64,
|
|
.os_tag = .ios,
|
|
});
|
|
|
|
const exe = b.addExecutable(.{
|
|
.name = "main",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = null,
|
|
.optimize = optimize,
|
|
.target = target,
|
|
.link_libc = true,
|
|
}),
|
|
});
|
|
|
|
const io = b.graph.io;
|
|
|
|
if (std.zig.system.darwin.getSdk(b.allocator, io, &target.result)) |sdk| {
|
|
b.sysroot = sdk;
|
|
exe.root_module.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
|
|
exe.root_module.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });
|
|
exe.root_module.addLibraryPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/lib" }) });
|
|
} else {
|
|
exe.step.dependOn(&b.addFail("no iOS SDK found").step);
|
|
}
|
|
|
|
exe.root_module.addCSourceFile(.{ .file = b.path("main.m"), .flags = &.{} });
|
|
exe.root_module.linkFramework("Foundation", .{});
|
|
exe.root_module.linkFramework("UIKit", .{});
|
|
}
|