Commit 73830cab authored by Nico Weber's avatar Nico Weber Committed by Chromium LUCI CQ

mac: Improve LLD build a tiny bit

- don't pass --no-call-graph-profile-sort to lld/Mach-O, it doesn't
  understand it and doesn't have a call-graph-based sorting feature yet
- implicitly disable fatal linker warnings for lld (else people will add
  the disabling to their args.gn and will then forget to remove it once
  it's no longer needed)
- update docs
-- mention that `llvm-ar` needs copying too
-- mention that an `ld64.lld.darwinnew` symlink must be created
-- mention that protoc not working is a (now) known issue

No behavior change for normal mac builds.

Bug: 1149587
Change-Id: I57d4c194338f97b7ca5325c022d606d8391eb955
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587359
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Auto-Submit: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836592}
parent 8d638ef7
......@@ -62,7 +62,9 @@ declare_args() {
# Enable fatal linker warnings. Building Chromium with certain versions
# of binutils can cause linker warning.
fatal_linker_warnings = true
# TODO(thakis): Set this to true unconditionally once lld/MachO bring-up
# is along far enough that it no longer emits linker warnings.
fatal_linker_warnings = !(is_apple && use_lld)
# Build with C++ RTTI enabled. Chromium builds without RTTI by default,
# but some sanitizers are known to require it, like CFI diagnostics
......@@ -723,7 +725,9 @@ config("compiler") {
if (use_lld && !enable_call_graph_profile_sort) {
if (is_win) {
ldflags += [ "/call-graph-profile-sort:no" ]
} else {
} else if (!is_apple) {
# TODO(thakis): Once LLD's Mach-O port basically works, implement call
# graph profile sorting for it, add an opt-out flag, and pass it here.
ldflags += [ "-Wl,--no-call-graph-profile-sort" ]
}
}
......
......@@ -56,7 +56,7 @@ different platforms.
- LLD does not yet have any ARM support
([in-progress patch](https://reviews.llvm.org/D88629))
- LLD-linked binaries don't work on macOS 10.13 or older
([bug](https://llvm.org/PR48395))
([bug](https://llvm.org/PR48395), fixed on llvm trunk)
- LLD cannot yet link swiftshader binaries ([bug](https://llvm.org/PR48332)) --
but other than that, all targets build
- LLD likely produces bad debug info, and LLD-linked binaries likely don't
......@@ -66,16 +66,20 @@ different platforms.
- We haven't tried actually running any other binaries, so chances are many
other tests fail
- LLD doesn't yet implement `-dead_strip`, leading to many linker warnings
- LLD doesn't yet implement deduplication (aka "ICF").
- LLD doesn't yet implement deduplication (aka "ICF")
- LLD doesn't yet call graph profile sort
- LLD doesn't yet implement `-exported_symbol` or `-exported_symbols_list`,
leading to some linker warnings
- LLD-linked `protoc` crashes when it runs as part of the build
([bug](https://llvm.org/PR48491))
## Opting in
1. First, obtain lld. Do either of:
1. build `lld` locally and copy it to
`third_party/llvm-build/Relase+Asserts/bin`
1. build `lld` and `llvm-ar` locally and copy it to
`third_party/llvm-build/Relase+Asserts/bin`. Also run
`ln -s lld third_party/llvm-build/Release+Asserts/bin/ld64.lld.darwinnew`.
2. run `src/tools/clang/scripts/update.py --package=lld_mac` to download a
prebuilt lld binary.
......@@ -87,10 +91,7 @@ different platforms.
2. Add `use_lld = true` to your args.gn
3. Add `fatal_linker_warnings = false` to your args.gn -- builds that use LLD
currently emit all kinds of warnings (see "Known issues" above).
4. Then just build normally.
3. Then just build normally.
`use_lld = true` makes the build use thin archives. For that reason, `use_lld`
also switches from `libtool` to `llvm-ar`.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment