[lld-macho] Have --reproduce account for path rerooting
authorJez Ng <jezng@fb.com>
Wed, 5 May 2021 18:38:36 +0000 (14:38 -0400)
committerJez Ng <jezng@fb.com>
Wed, 5 May 2021 18:41:01 +0000 (14:41 -0400)
commit20f51ffe67d12ab72c917dc4b371b55c80321393
tree03b3f44a03f6abdd0715c0a367b42321ca23ecb6
parent7907c46fe6195728fafd843b8c0fb19a3e68e9ad
[lld-macho] Have --reproduce account for path rerooting

We need to account for path rerooting when generating the response
file. We could either reroot the paths before generating the file, or pass
through the original filenames and change just the syslibroot. I've opted for
the latter, in order that the reproduction run more closely mirrors the
original.

We must also be careful *not* to make an absolute path relative if it is
shadowed by a rerooted path. See repro6.tar in reroot-path.s for
details.

I've moved the call to `createResponseFile()` after the initialization of
`config->systemLibraryRoots`, since it now needs to know what those roots are.

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D101224
lld/MachO/Driver.cpp
lld/MachO/Driver.h
lld/MachO/DriverUtils.cpp
lld/test/MachO/reroot-path.s