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

2022-08-16 Thread Quinn Pham via Phabricator via cfe-commits
quinnp added a comment.

Hi @MaskRay, could you please take a look at @nemanjai's suggestion?

> ...
> So I would prefer that we handle this in the CMake files if @MaskRay doesn't 
> object.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129855

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-07-26 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai added a comment.

In D129855#3667191 , @MaskRay wrote:

> In D129855#3662457 , @quinnp wrote:
>
>> In D129855#3657006 , @MaskRay 
>> wrote:
>>
>>> This is not right as using `ld.lld` as the default linker isn't the 
>>> majority case. If you want to change the default for your distribution, set 
>>> `-DCLANG_DEFAULT_LINKER=lld`.
>>> (Alternatively, you can have a `ld` symlink pointing to `lld`.)
>>
>> Hi @MaskRay! Do you mean I should abandon this change or find a way to set 
>> the CMake variable `CLANG_DEFAULT_LINKER` to `lld` as default when building 
>> for PowerPC Linux? I wasn't able to find any examples of people setting 
>> CMake variables for specific distributions.
>>
>> Thanks!
>
> You can customize `CLANG_DEFAULT_LINKER` in your clang distribution. I don't 
> find convincing argument to change the default for `PPCLinuxToolChain` and 
> diverge from `Linux`.

The reason we would like the default linker to be `ld.lld` for most/default 
builds on PPC is because using LTO without the GPL-licensed Gold plugin 
requires LLD. The idea is that a typical user can pull the source and build it 
with minimal CMake macros and get a working LTO without having to build the 
Gold plugin.

Of course, this may not be the way to accomplish this (i.e. this will make it 
diverge from the value specified in `CLANG_DEFAULT_LINKER` in 
`$LLVM_BUILD/tools/clang/include/clang/Config/config.h`). So I would prefer 
that we handle this in the CMake files if @MaskRay doesn't object.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129855

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-07-20 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D129855#3662457 , @quinnp wrote:

> In D129855#3657006 , @MaskRay wrote:
>
>> This is not right as using `ld.lld` as the default linker isn't the majority 
>> case. If you want to change the default for your distribution, set 
>> `-DCLANG_DEFAULT_LINKER=lld`.
>> (Alternatively, you can have a `ld` symlink pointing to `lld`.)
>
> Hi @MaskRay! Do you mean I should abandon this change or find a way to set 
> the CMake variable `CLANG_DEFAULT_LINKER` to `lld` as default when building 
> for PowerPC Linux? I wasn't able to find any examples of people setting CMake 
> variables for specific distributions.
>
> Thanks!

You can customize `CLANG_DEFAULT_LINKER` in your clang distribution. I don't 
find convincing argument to change the default for `PPCLinuxToolChain` and 
diverge from `Linux`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129855

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-07-19 Thread Quinn Pham via Phabricator via cfe-commits
quinnp added a comment.

In D129855#3657006 , @MaskRay wrote:

> This is not right as using `ld.lld` as the default linker isn't the majority 
> case. If you want to change the default for your distribution, set 
> `-DCLANG_DEFAULT_LINKER=lld`.
> (Alternatively, you can have a `ld` symlink pointing to `lld`.)

Hi @MaskRay! Do you mean I should abandon this change or find a way to set the 
CMake variable `CLANG_DEFAULT_LINKER` to `lld` as default when building for 
PowerPC Linux? I wasn't able to find any examples of people setting CMake 
variables for specific distributions.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129855

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-07-16 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

This is not right as using `ld.lld` as the default linker isn't the majority 
case. If you want to change the default for your distribution, set 
`-DCLANG_DEFAULT_LINKER=lld`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129855

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-07-15 Thread Quinn Pham via Phabricator via cfe-commits
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=`

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=` 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 ,
 llvm::opt::ArgStringList ) const override;
 
+  const char *getDefaultLinker() const override { return "ld.lld"; }
+
 private:
   bool SupportIEEEFloat128(const Driver , const llvm::Triple ,
const llvm::opt::ArgList ) const;


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 ,
 llvm::opt::ArgStringList ) const override;
 
+  const char *getDefaultLinker() const override { return "ld.lld"; }
+
 private:
   bool SupportIEEEFloat128(const Driver , const llvm::Triple ,
const llvm::opt::ArgList ) const;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits