[PATCH] D76452: Use LLD by default for Android.

2020-04-24 Thread Dan Albert via Phabricator via cfe-commits
danalbert added a comment.

In D76452#2002981 , @danalbert wrote:

> In D76452#2002917 , @MaskRay wrote:
>
> > In D76452#2002875 , @danalbert 
> > wrote:
> >
> > > In D76452#2002856 , @int3 wrote:
> > >
> > > > Yes, I was referring to that question too :) I'm working on the new 
> > > > lld-macho implementation, under the `DarwinNew` flavor. I'm not sure if 
> > > > anything depends on the old `Darwin` flavor, which is why we haven't 
> > > > removed it yet, though we plan to do that once we get the new 
> > > > implementation to a more mature stage.
> > >
> > >
> > > Ah, gotcha :) Thanks! Will wait for @ruiu to chime in.
> >
> >
> > I vote for deleting the `#ifdef __APPLE__` chunk so we don't have to add 
> > more code to either clang or lld
> >  The code owner of the existing lld darwin has explicitly expressed that we 
> > can drop the existing `Darwin` flavor at any time.
>
>
> SGTM. Abandoning this. I'll send a patch to remove the LLD side shortly.


https://reviews.llvm.org/D78837


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-04-24 Thread Dan Albert via Phabricator via cfe-commits
danalbert abandoned this revision.
danalbert added a comment.

In D76452#2002917 , @MaskRay wrote:

> In D76452#2002875 , @danalbert wrote:
>
> > In D76452#2002856 , @int3 wrote:
> >
> > > Yes, I was referring to that question too :) I'm working on the new 
> > > lld-macho implementation, under the `DarwinNew` flavor. I'm not sure if 
> > > anything depends on the old `Darwin` flavor, which is why we haven't 
> > > removed it yet, though we plan to do that once we get the new 
> > > implementation to a more mature stage.
> >
> >
> > Ah, gotcha :) Thanks! Will wait for @ruiu to chime in.
>
>
> I vote for deleting the `#ifdef __APPLE__` chunk so we don't have to add more 
> code to either clang or lld
>  The code owner of the existing lld darwin has explicitly expressed that we 
> can drop the existing `Darwin` flavor at any time.


SGTM. Abandoning this. I'll send a patch to remove the LLD side shortly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-04-24 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D76452#2002875 , @danalbert wrote:

> In D76452#2002856 , @int3 wrote:
>
> > Yes, I was referring to that question too :) I'm working on the new 
> > lld-macho implementation, under the `DarwinNew` flavor. I'm not sure if 
> > anything depends on the old `Darwin` flavor, which is why we haven't 
> > removed it yet, though we plan to do that once we get the new 
> > implementation to a more mature stage.
>
>
> Ah, gotcha :) Thanks! Will wait for @ruiu to chime in.


I vote for deleting the `#ifdef __APPLE__` chunk so we don't have to add more 
code to either clang or lld
The code owner of the existing lld darwin has explicitly expressed that we can 
drop the existing `Darwin` flavor at any time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-04-24 Thread Dan Albert via Phabricator via cfe-commits
danalbert added a comment.

In D76452#2002856 , @int3 wrote:

> Yes, I was referring to that question too :) I'm working on the new lld-macho 
> implementation, under the `DarwinNew` flavor. I'm not sure if anything 
> depends on the old `Darwin` flavor, which is why we haven't removed it yet, 
> though we plan to do that once we get the new implementation to a more mature 
> stage.


Ah, gotcha :) Thanks! Will wait for @ruiu to chime in.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-04-24 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

Yes, I was referring to that question too :) I'm working on the new lld-macho 
implementation, under the `DarwinNew` flavor. I'm not sure if anything depends 
on the old `Darwin` flavor, which is why we haven't removed it yet, though we 
plan to do that once we get the new implementation to a more mature stage.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-04-24 Thread Dan Albert via Phabricator via cfe-commits
danalbert added a comment.

In D76452#2002620 , @int3 wrote:

> I don't think I have enough context here to answer the question, but I'm 
> pretty sure that change wouldn't affect what I'm working on


Sorry, wasn't referring to that question specifically, but the LLD one that 
@MaskRay CC'd you for a little further up.

> But hope @ruiu or @int3 can clarify that we can't get rid of the __APPLE__ 
> special case in:
> 
>   // lld/tools/lld/lld.cpp
>   static Flavor parseProgname(StringRef progname) {
>   #if __APPLE__
> // Use Darwin driver for "ld" on Darwin.
> if (progname == "ld")
>   return Darwin;
>   #endif
>   
>   #if LLVM_ON_UNIX
> // Use GNU driver for "ld" on other Unix-like system.
> if (progname == "ld")
>   return Gnu;
>   #endif


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-04-24 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

I don't think I have enough context here to answer the question, but I'm pretty 
sure that change wouldn't affect what I'm working on


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-04-24 Thread Dan Albert via Phabricator via cfe-commits
danalbert added a comment.

In D76452#2000812 , @nickdesaulniers 
wrote:

> Can we use `-DCLANG_DEFAULT_LINKER=lld` to configure AOSP's distribution of 
> LLD, then require the use of `-fuse-ld= that is currently used>` when targeting OSX host tools?


It'd work (and might be a good short term solution here until we can get 
feedback from @ruiu, and @int3) but I'm not sure I like the idea of breaking 
the default Darwin configuration much more than the default Android 
configuration. It's less commonly used by our toolchain, but it's definitely 
used.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-04-23 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment.

Can we use `-DCLANG_DEFAULT_LINKER=lld` to configure AOSP's distribution of 
LLD, then require the use of `-fuse-ld=` when targeting OSX host tools?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-04-16 Thread Dan Albert via Phabricator via cfe-commits
danalbert added a comment.

Option 4 was (at least on the surface) super easy: 
https://reviews.llvm.org/D78328. lmk if you'd prefer that approach. I'm 
slightly less confident in it since it affects non-Android platforms as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-04-16 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.

LGTM.

But hope @ruiu or @int3 can clarify that we can't get rid of the `__APPLE__` 
special case in:

  // lld/tools/lld/lld.cpp
  static Flavor parseProgname(StringRef progname) {
  #if __APPLE__
// Use Darwin driver for "ld" on Darwin.
if (progname == "ld")
  return Darwin;
  #endif
  
  #if LLVM_ON_UNIX
// Use GNU driver for "ld" on other Unix-like system.
if (progname == "ld")
  return Gnu;
  #endif


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-04-16 Thread Dan Albert via Phabricator via cfe-commits
danalbert added a comment.

@MaskRay Any other ideas, or should I submit this? Reviewing all our options:

1. Installing LLD as simply "ld"

Rejected: Causes LLD to act in mach-o mode for Darwin

2. `-DCLANG_DEFAULT_LINKER=lld`

Rejected: Our host Darwin toolchain still uses the system's linker, not LLD, 
and this would change that too (and as you said, the mach-o support in LLD 
isn't ready and is about to be replaces, so we can't do this for our production 
toolchain).

3. Using a wrapper script to set `-flavor gnu`

Rejected: Wrappers don't work well on Windows hosts.

4. Teach LLD that Linux targets are `-flavor gnu`, regardless of host.

LLD doesn't seem to differentiate between Android and non-Android Linux, so 
this change would affect non-Android Linux targets as well. Is that a problem? 
Do non-Android Linux targets linked from Windows, Darwin, or WebASM want the 
host driver modes the //target// driver modes?

5. This patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-03-30 Thread Dan Albert via Phabricator via cfe-commits
danalbert added a comment.

In D76452#1945084 , @srhines wrote:

> In D76452#1945029 , @MaskRay wrote:
>
> > To cross build ELF object on macOS, another alternative is a wrapper named 
> > `ld` which invokes `lld -flavor gnu "$@"`
>
>
> @danalbert Would this kind of idea work with your other reverted patch? I'm 
> not sure exactly what broke on those builds.


Not really. Windows complicates things here, since it operates based on file 
extensions rather than shebangs. `ld.exe` is not `ld.cmd`, and `ld` (with no 
extension) doesn't work. Any system that expects one form won't work with the 
other. Beyond that, process creation is expensive on Windows so we should be 
avoiding as many superfluous processes as we can.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-03-26 Thread Stephen Hines via Phabricator via cfe-commits
srhines added a comment.

In D76452#1945029 , @MaskRay wrote:

> In D76452#1944786 , @srhines wrote:
>
> > In D76452#1944733 , @MaskRay wrote:
> >
> > > Another approach will be `-DCLANG_DEFAULT_LINKER=lld`. It provides a 
> > > default value for `-fuse-ld=`.
> >
> >
> > How does that work for Darwin builds? Is lld fully supported for MachO at 
> > this point, or will Clang still choose to use the preferred Apple linker?
>
>
> I am not clear about your use case. lld can be used as 
> ELF/Mach-O/COFF/WebAssembly linker. If you want to build ELF objects, 
> -fuse-ld=lld (via clangDriver) or configure clang with 
> -DCLANG_DEFAULT_LINKER=lld.
>  If you want to build Mach-O objects, lld's current Mach-O port lacks 
> features (and will be removed). The new Mach-O port is still under 
> development.


Right, so this is a problem when we ship a multi-target toolchain that does 
support targeting regular Linux, Windows, and Darwin (for host tools) in 
addition to Android. If we switched `CLANG_DEFAULT_LINKER`, then we would need 
to pass explicit flags to any Darwin builds to go back to using the system 
linker.

> To cross build ELF object on macOS, another alternative is a wrapper named 
> `ld` which invokes `lld -flavor gnu "$@"`

@danalbert Would this kind of idea work with your other reverted patch? I'm not 
sure exactly what broke on those builds.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-03-26 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

In D76452#1944786 , @srhines wrote:

> In D76452#1944733 , @MaskRay wrote:
>
> > Another approach will be `-DCLANG_DEFAULT_LINKER=lld`. It provides a 
> > default value for `-fuse-ld=`.
>
>
> How does that work for Darwin builds? Is lld fully supported for MachO at 
> this point, or will Clang still choose to use the preferred Apple linker?


I am not clear about your use case. lld can be used as 
ELF/Mach-O/COFF/WebAssembly linker. If you want to build ELF objects, 
-fuse-ld=lld (via clangDriver) or configure clang with 
-DCLANG_DEFAULT_LINKER=lld.
If you want to build Mach-O objects, lld's current Mach-O port lacks features 
(and will be removed). The new Mach-O port is still under development.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-03-26 Thread Stephen Hines via Phabricator via cfe-commits
srhines added a comment.

In D76452#1944733 , @MaskRay wrote:

> Another approach will be `-DCLANG_DEFAULT_LINKER=lld`. It provides a default 
> value for `-fuse-ld=`.


How does that work for Darwin builds? Is lld fully supported for MachO at this 
point, or will Clang still choose to use the preferred Apple linker?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-03-26 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Another approach will be `-DCLANG_DEFAULT_LINKER=lld`. It provides a default 
value for `-fuse-ld=`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-03-26 Thread Dan Albert via Phabricator via cfe-commits
danalbert reclaimed this revision.
danalbert added a comment.
This revision is now accepted and ready to land.

It seems I'd goofed something in my testing earlier (I think I still had 
`-fuse-ld=lld` force on in my build system). While Clang will find `ld` in the 
driver directory and prefer it, LLD defaults to the Darwin driver mode when 
`argv[0]` is `ld` when run on Darwin. We need GNU mode, and the best way to get 
this behavior is to have Clang invoke `ld.lld` instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-03-20 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Thanks for abandoning this patch. I am glad Android does not need customization 
on top of the generic Linux behavior. (This makes clangDriver clean.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-03-20 Thread Dan Albert via Phabricator via cfe-commits
danalbert abandoned this revision.
danalbert added a comment.

Looks like we don't actually need this. Can achieve the same effect by 
installing `ld.lld` to the same directory as Clang as `ld` and it'll be 
preferred over the other locations.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-03-20 Thread Stephen Hines via Phabricator via cfe-commits
srhines accepted this revision.
srhines added a comment.
This revision is now accepted and ready to land.

Thanks, Dan, for setting this up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-03-19 Thread Dan Albert via Phabricator via cfe-commits
danalbert updated this revision to Diff 251498.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76452

Files:
  clang/lib/Driver/ToolChains/Linux.h
  clang/test/Driver/Inputs/basic_android_tree/arm-linux-androideabi/bin/ld.lld
  clang/test/Driver/Inputs/basic_android_tree/bin/ld.lld
  clang/test/Driver/coverage-ld.c
  clang/test/Driver/fuse-ld.c
  clang/test/Driver/sanitizer-ld.c

Index: clang/test/Driver/sanitizer-ld.c
===
--- clang/test/Driver/sanitizer-ld.c
+++ clang/test/Driver/sanitizer-ld.c
@@ -146,7 +146,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s
 //
-// CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-ASAN-ANDROID-NOT: "-lc"
 // CHECK-ASAN-ANDROID-NOT: "-pie"
 // CHECK-ASAN-ANDROID-NOT: "-lpthread"
@@ -159,7 +159,7 @@
 // RUN: -static-libsan \
 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID-STATICLIBASAN %s
 //
-// CHECK-ASAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-ASAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-ASAN-ANDROID-STATICLIBASAN: libclang_rt.asan-arm-android.a"
 // CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
 // CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
@@ -169,7 +169,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-ANDROID %s
 //
-// CHECK-UBSAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-UBSAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-UBSAN-ANDROID-NOT: "-lc"
 // CHECK-UBSAN-ANDROID-NOT: "-pie"
 // CHECK-UBSAN-ANDROID-NOT: "-lpthread"
@@ -182,7 +182,7 @@
 // RUN: -static-libsan \
 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-ANDROID-STATICLIBASAN %s
 //
-// CHECK-UBSAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-UBSAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-UBSAN-ANDROID-STATICLIBASAN: libclang_rt.ubsan_standalone-arm-android.a"
 // CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
 // CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
@@ -193,7 +193,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID-X86 %s
 //
-// CHECK-ASAN-ANDROID-X86: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-ASAN-ANDROID-X86: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-ASAN-ANDROID-X86-NOT: "-lc"
 // CHECK-ASAN-ANDROID-X86-NOT: "-pie"
 // CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
@@ -214,7 +214,7 @@
 // RUN: -shared \
 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s
 //
-// CHECK-ASAN-ANDROID-SHARED: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-ASAN-ANDROID-SHARED: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lc"
 // CHECK-ASAN-ANDROID-SHARED: libclang_rt.asan-arm-android.so"
 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lpthread"
@@ -560,7 +560,7 @@
 // RUN: -target aarch64-linux-android -fuse-ld=ld \
 // RUN: --sysroot=%S/Inputs/basic_android_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-ANDROID %s
-// CHECK-CFI-CROSS-DSO-ANDROID: "{{.*}}ld{{(.exe)?}}"
+// CHECK-CFI-CROSS-DSO-ANDROID: "{{.*}}ld.lld{{(.exe)?}}"
 // CHECK-CFI-CROSS-DSO-ANDROID-NOT: libclang_rt.cfi
 
 // Cross-DSO CFI with diagnostics on Android links just the UBSAN runtime.
@@ -569,7 +569,7 @@
 // RUN: -target aarch64-linux-android -fuse-ld=ld \
 // RUN: --sysroot=%S/Inputs/basic_android_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-ANDROID %s
-// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{.*}}ld{{(.exe)?}}"
+// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{.*}}ld.lld{{(.exe)?}}"
 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{[^"]*}}libclang_rt.ubsan_standalone-aarch64-android.so"
 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "-export-dynamic-symbol=__cfi_check"
 
@@ -673,7 +673,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s
 //
-// CHECK-SAFESTACK-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-SAFESTACK-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-SAFESTACK-ANDROID-ARM-NOT: libclang_rt.safestack
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o -shared 2>&1 \
@@ -681,7 +681,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-SAFESTACK-SHARED-ANDROID-ARM %s
 //
-// CHECK-SAFESTACK-SHARED-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-SAFESTACK-SHARED-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-SAFESTACK-SHARED-ANDROID-ARM-NOT: libclang_rt.safestack
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 

[PATCH] D76452: Use LLD by default for Android.

2020-03-19 Thread Dan Albert via Phabricator via cfe-commits
danalbert created this revision.
danalbert added a reviewer: srhines.
danalbert added a project: clang.
Herald added a subscriber: cryptoad.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76452

Files:
  clang/lib/Driver/ToolChains/Linux.h
  clang/test/Driver/Inputs/basic_android_tree/arm-linux-androideabi/bin/ld.lld
  clang/test/Driver/Inputs/basic_android_tree/bin/ld.lld
  clang/test/Driver/coverage-ld.c
  clang/test/Driver/fuse-ld.c
  clang/test/Driver/sanitizer-ld.c

Index: clang/test/Driver/sanitizer-ld.c
===
--- clang/test/Driver/sanitizer-ld.c
+++ clang/test/Driver/sanitizer-ld.c
@@ -146,7 +146,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID %s
 //
-// CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-ASAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-ASAN-ANDROID-NOT: "-lc"
 // CHECK-ASAN-ANDROID-NOT: "-pie"
 // CHECK-ASAN-ANDROID-NOT: "-lpthread"
@@ -159,7 +159,7 @@
 // RUN: -static-libsan \
 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID-STATICLIBASAN %s
 //
-// CHECK-ASAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-ASAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-ASAN-ANDROID-STATICLIBASAN: libclang_rt.asan-arm-android.a"
 // CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
 // CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
@@ -169,7 +169,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-ANDROID %s
 //
-// CHECK-UBSAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-UBSAN-ANDROID: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-UBSAN-ANDROID-NOT: "-lc"
 // CHECK-UBSAN-ANDROID-NOT: "-pie"
 // CHECK-UBSAN-ANDROID-NOT: "-lpthread"
@@ -182,7 +182,7 @@
 // RUN: -static-libsan \
 // RUN:   | FileCheck --check-prefix=CHECK-UBSAN-ANDROID-STATICLIBASAN %s
 //
-// CHECK-UBSAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-UBSAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-UBSAN-ANDROID-STATICLIBASAN: libclang_rt.ubsan_standalone-arm-android.a"
 // CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lpthread"
 // CHECK-UBSAN-ANDROID-STATICLIBASAN-NOT: "-lrt"
@@ -193,7 +193,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID-X86 %s
 //
-// CHECK-ASAN-ANDROID-X86: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-ASAN-ANDROID-X86: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-ASAN-ANDROID-X86-NOT: "-lc"
 // CHECK-ASAN-ANDROID-X86-NOT: "-pie"
 // CHECK-ASAN-ANDROID-X86-NOT: "-lpthread"
@@ -214,7 +214,7 @@
 // RUN: -shared \
 // RUN:   | FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED %s
 //
-// CHECK-ASAN-ANDROID-SHARED: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-ASAN-ANDROID-SHARED: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lc"
 // CHECK-ASAN-ANDROID-SHARED: libclang_rt.asan-arm-android.so"
 // CHECK-ASAN-ANDROID-SHARED-NOT: "-lpthread"
@@ -560,7 +560,7 @@
 // RUN: -target aarch64-linux-android -fuse-ld=ld \
 // RUN: --sysroot=%S/Inputs/basic_android_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-ANDROID %s
-// CHECK-CFI-CROSS-DSO-ANDROID: "{{.*}}ld{{(.exe)?}}"
+// CHECK-CFI-CROSS-DSO-ANDROID: "{{.*}}ld.lld{{(.exe)?}}"
 // CHECK-CFI-CROSS-DSO-ANDROID-NOT: libclang_rt.cfi
 
 // Cross-DSO CFI with diagnostics on Android links just the UBSAN runtime.
@@ -569,7 +569,7 @@
 // RUN: -target aarch64-linux-android -fuse-ld=ld \
 // RUN: --sysroot=%S/Inputs/basic_android_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-ANDROID %s
-// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{.*}}ld{{(.exe)?}}"
+// CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{.*}}ld.lld{{(.exe)?}}"
 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "{{[^"]*}}libclang_rt.ubsan_standalone-aarch64-android.so"
 // CHECK-CFI-CROSS-DSO-DIAG-ANDROID: "-export-dynamic-symbol=__cfi_check"
 
@@ -673,7 +673,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s
 //
-// CHECK-SAFESTACK-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-SAFESTACK-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-SAFESTACK-ANDROID-ARM-NOT: libclang_rt.safestack
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o -shared 2>&1 \
@@ -681,7 +681,7 @@
 // RUN: --sysroot=%S/Inputs/basic_android_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-SAFESTACK-SHARED-ANDROID-ARM %s
 //
-// CHECK-SAFESTACK-SHARED-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-SAFESTACK-SHARED-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
 // CHECK-SAFESTACK-SHARED-ANDROID-ARM-NOT: libclang_rt.safestack
 
 // RUN: %clang