ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
32.02k stars 2.34k forks source link

"zig cc -E" creates an unexpected object file #20359

Open markus-oberhumer opened 1 week ago

markus-oberhumer commented 1 week ago

Zig Version

0.13.0

Steps to Reproduce and Observed Behavior

Probably related to macos handling.

# go to an empty directory

$ zig-0.13.0 cc -target aarch64-linux-gnu -E -x c -dM /dev/null
$ ls
# OK, still emtpy

$ zig-0.13.0 cc -target aarch64-macos-none -E -x c -dM /dev/null
$ ls
null.o
# ERROR, created file null.o !

Expected Behavior

zig cc -E should write to stdout and not create any files.

markus-oberhumer commented 1 week ago

Note that this behaviour causes real problems, e.g. it has broken our CI job

https://github.com/upx/upx-test-build-with-zig/actions/runs/9595438042/job/26460222818

markus-oberhumer commented 1 week ago

cc @kubkon

Vexu commented 1 week ago

Might also be related to #13179

markus-oberhumer commented 1 week ago

I don't think this is related:

Vexu commented 1 week ago
* `zig cc -E` should only write to stdout and never create any files

The files mentioned in that issue should never be created either.

* the problem only happens if you use `-target XXX-macos-none`, so this looks like a macos specific bug

I'd guess that is because we don't use LLD for macos.