[PATCH] D119049: [LLD] Allow usage of LLD as a library

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 14:36:36 PDT 2023


aganea added a comment.

I've reproduced the issue mentioned above. This doesn't happen on Windows/MSVC because `__FILE__` (used in the ROCm.cpp test) always expands to absolute paths when building LLVM, since `-DLLVM_USE_RELATIVE_PATHS_IN_FILES` requires `-ffile-prefix-map` which is unsupported on MSVC-cl/clang-cl. Instead, I've switched to using an environment variable `LLD_SRC_DIR` (which stores relative paths where applicable), see changes in `ROCm.cpp` and `lld/test/Unit/lit.cfg.py`.

I've also incorporated @thakis 's changes (if you don't mind) to make the lld unittest paths relocatable. You would still need D152885 <https://reviews.llvm.org/D152885> to make `lld/test` relocatable.

@MaskRay @thakis Would you mind taking another look please?



================
Comment at: lld/test/Unit/lit.site.cfg.py.in:9
+config.llvm_build_mode = lit_config.substitute("@LLVM_BUILD_MODE@")
+config.enable_shared = @ENABLE_SHARED@
+config.shlibdir = lit_config.substitute(path(r"@SHLIBDIR@"))
----------------
thakis wrote:
> Is this read by anything? clang/test/Unit/lit.site.cfg.py doesn't have it for example.
> 
> If not: What about the other vars in here? Are they copy-pasta, or are they needed?
Removed. It was remnants from a copy-paste (indeed) from MLIR.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119049/new/

https://reviews.llvm.org/D119049



More information about the llvm-commits mailing list