Open andrewrk opened 1 year ago
We encountered the same problem when using MicroZig to build C files for arm
Same issue here: building for ARM with some C sources. Disabling LTO works around it. An empty .c file + test.zig with only the entry point is enough to trigger the issue:
export fn _start() void {}
$ zig version
0.12.0
$ zig build-exe -target thumb-freestanding-eabihf test.zig empty.c -flto
LLD Link... warning(link): unexpected LLD stderr:
ld.lld: warning: Linking two modules of different target triples: 'test.o' is 'thumb-unknown-unknown-eabihf' whereas 'ld-temp.o' is 'thumbv6kz-unknown-unknown-eabihf'
$ zig build-exe -target thumb-freestanding-eabihf test.zig empty.c -fno-lto
# (success, no output)
zig build
reports any linker stderr output as an error (error: warning(link): unexpected LLD stderr:
), but since linking actually succeeded, it isn't re-done on subsequent invocations, so the error about LLD's warning only reappears the next time something else changes to trigger linking. (That seems like its own bug: errors should not vanish until solved or perhaps linker warnings should not be reported as an error in the first place?...)
Extracted from https://github.com/ziglang/zig/pull/14647.
There are two problems here. One is https://github.com/ziglang/zig/issues/14908. The other looks like zig is failing to put the subarch into the llvm triple. This issue is to track the latter issue.
https://github.com/ziglang/zig/blob/b4d58e93ea4d0bbfe674f80d301279d302fe8fc8/test/tests.zig#L1019-L1066