Open DanB91 opened 4 years ago
Thanks for the report. I believe this was fixed by 5b5097a22a380a93a0f205ba218e8290a42ad051
This has not been solved yet:
➜ 7266 ls
main.zig
➜ 7266 zig build-exe main.zig -femit-asm=asm.s
➜ 7266 ls
asm.s main main.zig zig-cache
➜ 7266 rm asm.s
➜ 7266 ls
main main.zig zig-cache
➜ 7266 zig build-exe main.zig -femit-asm=asm.s
➜ 7266 ls
main main.zig zig-cache
As you can see, when the asm.s
file is removed, it is not recreated.
The nature of this issue is changed after 5b5097a22a380a93a0f205ba218e8290a42ad051. Before, adding -femit-asm=foo.s
to a previous compilation would not produce the foo.s file. Now it will, but there are still other cases to consider. Here is the current situation:
When you build a compilation, there is a zig-cache directory that gets the build artifacts. The way -femit-foo=bar
options currently work is that they override the output path, so instead of the build artifacts going to the zig-cache directory, they in fact go to the explicitly specified path instead. For -femit-bin=foo
this works fine because we have disable_lld_caching
which always writes the output to the specified path. For the other options such as -femit-asm=foo
when the input file is unchanged, the cache system tells us there is nothing to be done. However, if any of the source files are modified, the cache system will identify that the output file needs to be updated and everything works properly.
In short summary, this issue is open to represent the use case of the following options, under specific circumstances:
\\ -femit-asm[=path] Output .s (assembly code)
\\ -fno-emit-asm (default) Do not output .s (assembly code)
\\ -femit-zir[=path] Produce a .zir file with Zig IR
\\ -fno-emit-zir (default) Do not produce a .zir file with Zig IR
\\ -femit-llvm-ir[=path] Produce a .ll file with LLVM IR (requires LLVM extensions)
\\ -fno-emit-llvm-ir (default) Do not produce a .ll file with LLVM IR
\\ -femit-h[=path] Generate a C header file (.h)
\\ -fno-emit-h (default) Do not generate a C header file (.h)
\\ -femit-docs[=path] Create a docs/ dir with html documentation
\\ -fno-emit-docs (default) Do not produce docs/ dir with html documentation
\\ -femit-analysis[=path] Write analysis JSON file with type information
\\ -fno-emit-analysis (default) Do not write analysis JSON file with type information
The circumstances are:
I am trying to generate asm using the following command
zig build-obj -femit-asm=build/asm.s -target x86_64-uefi-gnu program.zig
. Unfortunately asm.s is only generated when zig-cache is not present. Once it generates the asm, it will not generate another copy unless zig-cache is deleted. I am running the release version of zig 0.7.0. `