Closed Bug 1480005 Opened 3 years ago Closed 9 months ago

Automatically use llvm-ar, llvm-ranlib and llvm-nm when building with llvm-based LTO

Categories

(Firefox Build System :: General, enhancement)

enhancement
Not set
normal

Tracking

(firefox86 fixed)

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(4 files)

No description provided.
Blocks: android-lto
It'd be nice to have longer term, but I'll just hack up mozconfigs for my needs for now.

Fixing this properly will require moving the detection to moz.configure, and detect and handle llvm toolchains generically (e.g. looking for llvm-$tool-$version where $version matches that of clang-$version, if the compiler is not the short "clang").
Assignee: mh+mozilla → nobody
No longer blocks: android-lto
Duplicate of this bug: 1539280
Duplicate of this bug: 1652413

What exactly must be added to the mozconfig to work around this?

Flags: needinfo?(mh+mozilla)

AR=llvm-ar
RANLIB=llvm-ranlib
NM=llvm-nm

You may need the full paths, and you may need to export the variables.

Flags: needinfo?(mh+mozilla)

The linker is always lld-link, as we don't support MSVC anymore, so the
fallback to "lib" is never used.

Assignee: nobody → mh+mozilla
Status: NEW → ASSIGNED

And stop setting AR to llvm-ar in mozconfigs.

It hasn't been used since bug 569597 and bug 1295937.

There is only one place where it's used:
config/check_vanilla_allocations.py, which is only executed from
js/src/build/Makefile.in on the condition that the build is targeting
Linux and not LTO. But the LTO test is actually outdated, because we
don't build with -flto, but -flto=thin, so the exclusion doesn't
work anymore.

There is however no AC_CHECK_PROG, and we currently rely on NM to be
given, or fall back to "nm", which works in most cases, except LTO with
clang. It works on CI because in LTO builds we explicitly set NM to
llvm-nm (which can output symbols from LLVM bitcode objects), but we
could also do that automatically.

So we add a full detection of nm/llvm-nm to python configure, and limit
it to Linux, since we only ever use it there.

Blocks: 1686646
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/feeb84104920
Always use llvm-lib when targetting Windows. r=firefox-build-system-reviewers,dmajor
https://hg.mozilla.org/integration/autoland/rev/3f9924127a79
Look for llvm-ar for AR when compiling with clang. r=firefox-build-system-reviewers,nalexander
https://hg.mozilla.org/integration/autoland/rev/300c5c7f61b7
Remove check for RANLIB. r=firefox-build-system-reviewers,nalexander
https://hg.mozilla.org/integration/autoland/rev/061ad2d4f4e3
Move NM to python configure. r=firefox-build-system-reviewers,nalexander
You need to log in before you can comment on or make changes to this bug.