-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Android NDK, no Link-Time Optimization? #13287
Copy link
Copy link
Closed
Labels
P2We'll consider working on this in future. (Assignee optional)We'll consider working on this in future. (Assignee optional)area-EngProdBazel CI, infrastructure, bootstrapping, release, and distribution toolingBazel CI, infrastructure, bootstrapping, release, and distribution toolingteam-AndroidIssues for Android teamIssues for Android teamtype: bug
Metadata
Metadata
Assignees
Labels
P2We'll consider working on this in future. (Assignee optional)We'll consider working on this in future. (Assignee optional)area-EngProdBazel CI, infrastructure, bootstrapping, release, and distribution toolingBazel CI, infrastructure, bootstrapping, release, and distribution toolingteam-AndroidIssues for Android teamIssues for Android teamtype: bug
Hi awesome Bazel folks,
I was debugging an NDK build and looking at the link commands being run. I happened to notice that dbg and opt builds are getting the exact same set of linker flags--no
-flto(or-O#) flags in either case. That made me wonder if Bazel is accidentally omitting link-time optimization (LTO) in optimized builds.[I'm assume Bazel (a) intends to have optimized (opt) builds run with LTO, and (b) that those flags would be show up in the link command dumped in
--verbose_failures. Apologies if I've missed something somewhere and this is a false alarm, but then maybe we should clarify the docs and have consistency across platforms.]Easiest way to repro should be the Bazel NDK example. (I'm using NDK21, macOS 11, Bazel 4, if that might matter.) I was looking at it by building with an invalid linker flag and
--verbose_failures.Thanks for taking a peek,
Chris