llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.69k stars 11.87k forks source link

`ld64.lld --reproduce` produces confusing tar file if `-Lnonexistent-dir` is passed #62786

Open nico opened 1 year ago

nico commented 1 year ago
cd /tmp
mkdir foo
cd foo
cat > main.c
echo 'int main() {}' > main.c
mkdir foo
 ~/src/llvm-project/out/gn/bin/clang main.c -fuse-ld=lld -isysroot $(xcrun -show-sdk-path) -Wl,--reproduce=repro.tar -Lfoo -Wl,-fatal_warnings
open repro.tar
cd repro
~/src/llvm-project/out/gn/bin/ld64.lld @response.txt
ld64.lld: error: directory not found for option -Ltmp/foo/foo

Looks like we don't include empty directories in the tar for unused -L flags.

(Looks like ld.lld doesn't warn about -L flags pointing to nonexistent dirs, so it doesn't have this problem)

llvmbot commented 1 year ago

@llvm/issue-subscribers-lld-macho

nico commented 1 year ago

lld-link also doesn't diag -libpath:asfsdfasdf.

keith commented 1 year ago

I guess the warning is following after ld64 which does warn for missing directories. I have generally found that useful since it often points to a bug in the build system adding the wrong flags in my experience

nico commented 1 year ago

Sure, we should keep the warning, we should just make --reproduce not conflict with it :)

(Probably by including an empty dir in the tar for these flags.)