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

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 5 14:37:31 PST 2023


aganea updated this revision to Diff 494949.
aganea added a comment.

As suggested by @MaskRay. This changes a few things, but it's for the best I think:

- Fix circular dependency between lldCommon and the lld drivers.
- Change safeLldMain -> lldMain and make it the only entry point.
- Pass down drivers symbols from the caller to lldCommon. This also makes it easier to discriminate between what drivers are linked in the PE, and what it isn't available.
- Remove all drivers' declarations from Drivers.h, the only usage allowed is to just use lldMain().
- Tested on Linux with -DBUILD_SHARED_LIBS=ON.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119049

Files:
  lld/CMakeLists.txt
  lld/COFF/Driver.cpp
  lld/COFF/Options.td
  lld/Common/CMakeLists.txt
  lld/Common/DriversMain.cpp
  lld/ELF/Driver.cpp
  lld/ELF/Options.td
  lld/MachO/Driver.cpp
  lld/MachO/Options.td
  lld/MinGW/Driver.cpp
  lld/MinGW/Options.td
  lld/include/lld/Common/Driver.h
  lld/test/CMakeLists.txt
  lld/test/Unit/lit.cfg.py
  lld/test/Unit/lit.site.cfg.py.in
  lld/tools/lld/lld.cpp
  lld/unittests/AsLibAll/AllDrivers.cpp
  lld/unittests/AsLibAll/CMakeLists.txt
  lld/unittests/AsLibELF/CMakeLists.txt
  lld/unittests/AsLibELF/Inputs/kernel1.o
  lld/unittests/AsLibELF/Inputs/kernel2.o
  lld/unittests/AsLibELF/ROCm.cpp
  lld/unittests/AsLibELF/SomeDrivers.cpp
  lld/unittests/CMakeLists.txt
  lld/wasm/Driver.cpp
  lld/wasm/Options.td
  llvm/cmake/modules/AddLLVM.cmake

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119049.494949.patch
Type: text/x-patch
Size: 34833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230205/5a3b1d41/attachment.bin>


More information about the llvm-commits mailing list