Skip to content

ld.lld: warning: Linking two modules of different target triples ... arm-unknown-linux-musleabihf vs armv6kz-unknown-linux-musleabihf #14962

Description

@andrewrk

Extracted from #14647.

There are two problems here. One is #14908. The other looks like zig is failing to put the subarch into the llvm triple. This issue is to track the latter issue.

ld.lld: warning: Linking two modules of different target triples: '/home/andy/Downloads/zig/zig-cache/o/610cf441612621c1d4bea0844fb8daea/test.o' is 'arm-unknown-linux-musleabihf' whereas 'ld-temp.o' is 'armv6kz-unknown-linux-musleabihf'

zig/test/tests.zig

Lines 1019 to 1066 in b4d58e9

pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *Step {
const step = b.step("test-c-abi", "Run the C ABI tests");
const optimize_modes: [2]OptimizeMode = .{ .Debug, .ReleaseFast };
for (optimize_modes) |optimize_mode| {
if (optimize_mode != .Debug and skip_release) continue;
for (c_abi_targets) |c_abi_target| {
if (skip_non_native and !c_abi_target.isNative()) continue;
if (c_abi_target.isWindows() and c_abi_target.getCpuArch() == .aarch64) {
// https://github.com/ziglang/zig/issues/14908
continue;
}
const test_step = b.addTest(.{
.root_source_file = .{ .path = "test/c_abi/main.zig" },
.optimize = optimize_mode,
.target = c_abi_target,
});
if (c_abi_target.abi != null and c_abi_target.abi.?.isMusl()) {
// TODO NativeTargetInfo insists on dynamically linking musl
// for some reason?
test_step.target_info.dynamic_linker.max_byte = null;
}
test_step.linkLibC();
test_step.addCSourceFile("test/c_abi/cfuncs.c", &.{"-std=c99"});
// test-c-abi should test both with LTO on and with LTO off. Only
// some combinations are passing currently:
// https://github.com/ziglang/zig/issues/14908
if (c_abi_target.isWindows()) {
test_step.want_lto = false;
}
const triple_prefix = c_abi_target.zigTriple(b.allocator) catch @panic("OOM");
test_step.setName(b.fmt("test-c-abi-{s}-{s} ", .{
triple_prefix, @tagName(optimize_mode),
}));
const run = test_step.run();
run.skip_foreign_checks = true;
step.dependOn(&run.step);
}
}
return step;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions