Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] SCons: Refactor Linux linker options with linker=<bfd|gold|lld|mold> #63283

Merged

Conversation

akien-mga
Copy link
Member

Backport of #63278, with the difference that I kept a compatibility alias for use_lld=yes.

@akien-mga akien-mga added this to the 3.5 milestone Jul 21, 2022
@akien-mga akien-mga requested review from a team as code owners July 21, 2022 12:05
@akien-mga akien-mga changed the title SCons: Refactor Linux linker options with linker=<bfd|gold|lld|mold> [3.x] SCons: Refactor Linux linker options with linker=<bfd|gold|lld|mold> Jul 21, 2022
@akien-mga akien-mga force-pushed the 3.x-scons-linux-refactor-linker branch from 1c9770d to d5b1949 Compare July 21, 2022 12:16
The new option is `linker` and lets the user specify the argument to
the`-fuse_ld=` linker flag directly. The supported options are:

- `default`: No change, typically uses GNU ld (bfd) unless the user or
  distro picked a different default `/usr/bin/ld`.
- `bfd`: GNU ld from binutils
- `gold`: GNU gold from binutils
- `lld`: lld from LLVM
- `mold`: mold, an extremely fast modern linker, not (yet) intended for
  use in production but great for development speed. Provided by distro
  `mold` package or needs to be compiled from source and installed to
  `/usr` otherwise.

Deprecates the `use_lld=yes` option, and make lld actually usable with
GCC too.

Not all the above are compatible or recommend for LTO, we recommend
using GNU ld with GCC LTO, or lld with LLVM ThinLTO.

(cherry picked from commit 534f85add1daec0669a1f18edd2cc456f9a296ef)
@akien-mga akien-mga force-pushed the 3.x-scons-linux-refactor-linker branch from d5b1949 to 5bb3063 Compare July 21, 2022 23:03
@akien-mga akien-mga merged commit 364071c into godotengine:3.x Jul 22, 2022
@akien-mga akien-mga deleted the 3.x-scons-linux-refactor-linker branch July 22, 2022 09:40
@lawnjelly
Copy link
Member

lawnjelly commented Jul 31, 2022

Ah so that's why my link time shot up this week. 😀 I'm not sure the alias for lld=yes was working BTW.

lld=yes prints the deprecated message, but build time 25 seconds.
linker=lld build time 14 seconds.

@akien-mga
Copy link
Member Author

akien-mga commented Jul 31, 2022

Yeah seems like I used == instead of =. Maybe we should run a Python linter on CI.

akien-mga added a commit to akien-mga/godot that referenced this pull request Sep 5, 2022
Adds support for LTO on macOS and Android.
Disable LTO by default on iOS even if `production=yes` is set.

Also add `linker` option to `server` platform missed in godotengine#63283.

Refactor code handling old arguments to make it simpler (breaks compat,
but is explicit enough about it and scripts are easy to fix).
Riordan-DC pushed a commit to Riordan-DC/godot that referenced this pull request Jan 24, 2023
Adds support for LTO on macOS and Android.
Disable LTO by default on iOS even if `production=yes` is set.

Also add `linker` option to `server` platform missed in godotengine#63283.

Refactor code handling old arguments to make it simpler (breaks compat,
but is explicit enough about it and scripts are easy to fix).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants