[PATCH] D129855: [clang][PowerPC] Set lld as clang's default linker for PowerPC Linux

Quinn Pham via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 15 07:11:28 PDT 2022


quinnp created this revision.
Herald added subscribers: steven.zhang, shchenz, kbarton, nemanjai.
Herald added a project: All.
quinnp requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

This patch changes the default linker for `clang` on PowerPC Linux to `lld`.
Here is a summary of the expected behaviour before and after this patch:

To use `lld` as the linker before this patch:

- build with `lld` in `LLVM_ENABLE_PROJECTS`
- build with `-DCLANG_DEFAULT_LINKER=lld`

To use `lld` as the linker after this patch:

- build with `lld` in `LLVM_ENABLE_PROJECTS`

To use `ld` as the linker before this patch:

- default behaviour

To use `ld` as the linker after this patch:

- build with `-DCLANG_DEFAULT_LINKER=<PATH_TO_LD>`

Note: After this patch, if you build `clang` for PowerPC Linux and `lld` is not
included in `LLVM_ENABLE_PROJECTS`, the built compiler will report an error
during linking on PowerPC Linux. Therefore, anyone using the default behaviour
before this patch will need to modify their build configuration to either:

- include `-DCLANG_DEFAULT_LINKER=<PATH_TO_LD>` to continue using `ld` or
- `lld` in `LLVM_ENABLE_PROJECTS` to switch to `lld`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129855

Files:
  clang/lib/Driver/ToolChains/PPCLinux.h


Index: clang/lib/Driver/ToolChains/PPCLinux.h
===================================================================
--- clang/lib/Driver/ToolChains/PPCLinux.h
+++ clang/lib/Driver/ToolChains/PPCLinux.h
@@ -24,6 +24,8 @@
   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
                             llvm::opt::ArgStringList &CC1Args) const override;
 
+  const char *getDefaultLinker() const override { return "ld.lld"; }
+
 private:
   bool SupportIEEEFloat128(const Driver &D, const llvm::Triple &Triple,
                            const llvm::opt::ArgList &Args) const;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129855.444973.patch
Type: text/x-patch
Size: 589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220715/52b6d236/attachment.bin>


More information about the cfe-commits mailing list