wasi-sdk
wasi-sdk copied to clipboard
writing output to a path with `%` in the dir component fails
checked wasi-sdk 12.0 & 16.0 ... both fail in this way
$ tar xf wasi-sdk-16.0-linux.tar.gz
$ cd wasi-sdk-16.0
$ echo 'int main(){return 0;}' > test.c
# This works.
$ ./bin/clang test.c -o foo%file
# This fails.
$ mkdir foo%
$ ./bin/clang test.c -o foo%/file
wasm-ld: error: cannot open output file foo%/file: No such file or directory
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
Looks like a bug in lld. It seems to effect both wasm-ld
and ld.lld
.
clang -o foo%/a.out test.c
works but clang -o foo%/a.out test.c -fuse-ld=lld
fails in the same way that wasm-ld failes:
$ clang -fuse-ld=lld test.c -o foo%/a.out
ld.lld: error: cannot open output file foo%/a.out: No such file or directory
So it seems like a upstream lld bug. Do you want to open a bug there, or should I?
i tried with plain clang
and it worked, but maybe my llvm isn't up-to-date. if you want to throw it upstream for tracking, sounds fine to me. i rarely interact with the llvm project myself.
Did you try with lld (i.e. -fuse-ld=lld
)?
This is now tracked in https://github.com/llvm/llvm-project/issues/58296.