Add an --enable-thinlto (or similar) for Windows

RESOLVED FIXED in Firefox 63

Status

enhancement
RESOLVED FIXED
Last year
7 months ago

People

(Reporter: dmajor, Assigned: dmajor)

Tracking

3 Branch
mozilla63
Dependency tree / graph

Firefox Tracking Flags

(firefox63 fixed)

Details

Attachments

(2 attachments)

When set, this flag should:

* Complain if the linker is not lld-link
* Add -flto=thin to MOZ_OPTIMIZE_FLAGS (probably want to coordinate with bug 1448978)
* Add -FORCE to LDFLAGS until bug 1448976 is addressed
* Change AR and to llvm-lib, and add -llvmlibthin to AR_FLAGS
* Maybe? change HOST_AR to llvm-lib. It seems like we shouldn't need this but I needed it to make my build work. I didn't need to change HOST_AR_FLAGS.
And possibly also add -OPT:LLDLTO=3 to LDFLAGS.
(In reply to David Major [:dmajor] from comment #1)
> And possibly also add -OPT:LLDLTO=3 to LDFLAGS.

But be careful with Spidermonkey builds: 
LINK : fatal error LNK1117: syntax error in option 'OPT:LLDLTO=3'
Something like --enable-lto=thin would probably be better.
No objection from me.
tjr is working on getting LTO or ThinLTO working with clang builds on Linux as a prerequisite to making clang CFI work, so it'd be great if we could make this work there as well.
See Also: → 1457482
I wrote this just to help me understand the next patch better
Assignee: nobody → dmajor
Attachment #8992012 - Flags: review?(core-build-config-reviews)
Attachment #8992013 - Flags: review?(core-build-config-reviews)
Blocks: 1475660
Attachment #8992012 - Flags: review?(core-build-config-reviews) → review+
Comment on attachment 8992013 [details] [diff] [review]
Make --enable-lto work with clang-cl

Review of attachment 8992013 [details] [diff] [review]:
-----------------------------------------------------------------

Not a huge fan of the massive amount of indentation here, but oh well.  r=me with the change below.

::: build/moz.configure/toolchain.configure
@@ +1332,3 @@
>  
> +    if value:
> +        enabled = "1"

Can we not just make this `True`, and add_old_configure_assignment will DTRT?  Assigning "1" is...weird.
Attachment #8992013 - Flags: review?(core-build-config-reviews) → review+
> Can we not just make this `True`, and add_old_configure_assignment will
> DTRT?  Assigning "1" is...weird.

Sounds good to me. I didn't know add_old_configure_assignment could do that. I was just refactoring the existing "1" code.
Pushed by dmajor@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/34a44432715b
prequel: Rename LTO `flags` to `cflags`. r=froydnj
https://hg.mozilla.org/integration/mozilla-inbound/rev/a2ae515ee43f
Make --enable-lto work with clang-cl. r=froydnj
https://hg.mozilla.org/mozilla-central/rev/34a44432715b
https://hg.mozilla.org/mozilla-central/rev/a2ae515ee43f
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Version: Version 3 → 3 Branch
You need to log in before you can comment on or make changes to this bug.