This patch is mostly for discussion, it is not ideal, but I have no better solution in mind atm.
I observed this issue few times earlier, but last days I am facing it too often when running
other people reproduces.
Problem is next. I can following invocation under ubuntu:
~/LLVM/llvm-build/bin/clang-5.0 -fuse-ld=lld test.c -l stdc++ -o out -v -Wl,--reproduce,out.tar
Result out.tar contains usr\lib64\libc.so which is a linker script and has GROUP command:
GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib64/ld-linux-x86-64.so.2 ) )
Our --reproduce logic correctly includes these 3 files into result tar. Final reproduce file works fine
under the same ubuntu, but if I want to run this reproduce under windows or on system that does not have these
files at absolute path, e.g. there is no file /lib64/libc.so.6, then LLD will fail.
It happens because even running the reproduce, such files from GROUP options are taken
from outside, what breaks concept of "black box".
It is sure undesirable and incorrect and makes sometimes hard to run wild repro files.
I though about we can rewrite such scripts before including them into Tar, but at the same time
it is probably not too nice to modify original files used for reproduce, so I refused from this idea.
In this patch I added new option --reproduce-use which informs linker that it runs under
debug reproduce environment and should never use absolute pathes, but convert them to relative.
That fixes issue I am observing.
No testcase included beause would like to discuss possible solutions at first.