wasi-sdk icon indicating copy to clipboard operation
wasi-sdk copied to clipboard

writing output to a path with `%` in the dir component fails

Open vapier opened this issue 2 years ago • 3 comments

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)

vapier avatar Oct 11 '22 09:10 vapier

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?

sbc100 avatar Oct 11 '22 14:10 sbc100

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.

vapier avatar Oct 11 '22 16:10 vapier

Did you try with lld (i.e. -fuse-ld=lld)?

sbc100 avatar Oct 11 '22 17:10 sbc100

This is now tracked in https://github.com/llvm/llvm-project/issues/58296.

sunfishcode avatar Nov 21 '22 13:11 sunfishcode