Skip to content

Comments

Pass -object_path_lto <path> linker flag for LTO builds (#420)#428

Merged
keith merged 1 commit intobazelbuild:masterfrom
ma-oli:add-lto-object-path
Sep 2, 2025
Merged

Pass -object_path_lto <path> linker flag for LTO builds (#420)#428
keith merged 1 commit intobazelbuild:masterfrom
ma-oli:add-lto-object-path

Conversation

@ma-oli
Copy link
Contributor

@ma-oli ma-oli commented Sep 2, 2025

The following commit (in 1.23.0) was reverted recently (in 1.23.1):

This patch is a new attempt at getting that feature merged, but without the LTO related issues that came up in the first patch. The difference is that we're adding that feature unconditionally now, as it won't hurt linking actions when LTO is disabled anyway. And enabling the bazel lto features changes the linking workflow in a way that isn't necessary on Apple platforms.

Initial commit log below.

This is needed for LTO builds, this is the path to which linker writes one big object file after performing link time optimisations, and then this object file would be used during final linking to create the App binary, without this file binary would contain invalid debug symbols, more info - bazelbuild/rules_swift#1529 .

Closes - bazelbuild/rules_swift#1529

The following commit (in 1.23.0) was reverted recently (in 1.23.1):
* commit 61b44d1
* revert 4c51f10

This patch is a new attempt at getting that feature merged, but without
the LTO related issues that came up in the first patch. The difference
is that we're adding that feature unconditionally now, as it won't hurt
linking actions when LTO is disabled anyway. And enabling the bazel lto
features changes the linking workflow in a way that isn't necessary on
Apple platforms.

Initial commit log below.
---

This is needed for LTO builds, this is the path to which linker writes
one big object file after performing link time optimisations, and then
this object file would be used during final linking to create the App
binary, without this file binary would contain invalid debug symbols,
more info - bazelbuild/rules_swift#1529 .

Closes - bazelbuild/rules_swift#1529

Co-authored-by: Mathieu Olivari <[email protected]>
Co-authored-by: Sanju Naik <[email protected]>
@ma-oli
Copy link
Contributor Author

ma-oli commented Sep 2, 2025

Cc: @sanju-naik

Copy link
Member

@keith keith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed that this is a no-op unless LTO is actually produced in the build. seems harmless to me.

@keith keith merged commit 1f942ef into bazelbuild:master Sep 2, 2025
12 checks passed
@sanju-naik
Copy link
Contributor

Thank you @ma-oli @keith for adding this back 🙏 . So the issue was happening because of adding these features - https://github.com/bazelbuild/apple_support/pull/420/files#diff-f87c478e9c0e6197378202814ad77531a720f7f1553c522123ba85e12de5e45aR2636, which weren't compatible or needed more things when building on non-Apple platforms?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants