[PATCH] D95166: Disable rosegment for old Android versions.

Dan Albert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 28 14:47:20 PST 2021


danalbert added a comment.

In D95166#2527437 <https://reviews.llvm.org/D95166#2527437>, @vitalybuka wrote:

> Our Android build bot is broken after this patch http://lab.llvm.org:8011/#/builders/77/builds/3234

Shouldn't that build be using lld?

In D95166#2526839 <https://reviews.llvm.org/D95166#2526839>, @glandium wrote:

> "Android only supports lld" might be true now, but it hasn't always been true, which means the change is not backwards compatible with versions of the NDK that don't use lld.

If I'm understanding correctly, Firefox is building a custom toolchain for use with the NDK sysroot? That works as long as you're building the whole toolchain (though we can't guarantee that even that will work out of the box, because these things are developed in tandem and other configurations are not tested), but you'll need to build lld, llvm-ar, etc and use those as well.

> Also, `-fuse-ld` is still a valid flag that can allow to use a different linker than lld.

We could check `-fuse-ld` for something other than `ld` or `lld` and not pass these flags in those cases. Would that be suitable? I see Clang did recently gain a `LinkerIsLLD` out param for `Toolchain::GetLinkerPath`. It's wrong for Android toolchains (because it assumes `ld` is not `lld`), but we could fix that. It'd be wrong whenever someone is using any toolchain other than the default NDK configuration (which would include Firefox), but at least it'd work for the common case.

A better solution IMO would be to let each target have its own default linker. We currently have this at the OS level, but that means that Android and GNU systems are assumed to have the same default linker. That's false. I'd tried fixing this with https://reviews.llvm.org/D76452 but the patch was not accepted. I'd be happy to revive and submit that if folks agree that it is the better choice.

Though TBH my favorite solution is still to make it clear that Android no longer supports anything but lld and skip all the special cases that will never get tested in practice. gold and bfd just barely worked for Android even when they were our defaults. One of the other fixes I suggest might fix your build today, but it's doubtful to me that it'd help you for long.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95166



More information about the cfe-commits mailing list