RFR: 8304893: Link Time Optimization with gcc can be faster
David Holmes
dholmes at openjdk.org
Mon Mar 27 05:51:32 UTC 2023
On Fri, 24 Mar 2023 17:12:26 GMT, Julian Waters <jwaters at openjdk.org> wrote:
> A previous argument against link time optimization support that we have for gcc is that it was extremely slow. After some checks it turns out we are passing rather inefficient flags to gcc in optimized builds. Changing these flags to run the linker optimizations in parallel and passing additional flags to the compiler have the ability to speed this process up significantly. Also fixes some incorrect flags passed to ld for linking as well
make/autoconf/flags-ldflags.m4 line 73:
> 71: fi
> 72:
> 73: # Moved optimization flags to JvmFeatures.gmk, was -Wl,-O1
Please delete. This type of comment has no context when not seen in this PR. Nobody knows something else used to be here.
make/hotspot/lib/JvmFeatures.gmk line 172:
> 170: JVM_OPTIMIZATION := HIGHEST_JVM
> 171: ifeq ($(call isCompiler, gcc), true)
> 172: JVM_CFLAGS_FEATURES += -flto=$(JOBS) -fuse-linker-plugin -fno-strict-aliasing -fno-fat-lto-objects
`-fno-fat-lto-objects` has been the default for a while now ( at least gcc 10+)
make/hotspot/lib/JvmFeatures.gmk line 173:
> 171: ifeq ($(call isCompiler, gcc), true)
> 172: JVM_CFLAGS_FEATURES += -flto=$(JOBS) -fuse-linker-plugin -fno-strict-aliasing -fno-fat-lto-objects
> 173: JVM_LDFLAGS_FEATURES += -O3 -flto=$(JOBS) -fuse-linker-plugin -fno-strict-aliasing
Shouldn't the `-O3` be using the `OPTIMIZATION` level in case it has been overridden from `HIGHEST_JVM`?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13180#discussion_r1148798280
PR Review Comment: https://git.openjdk.org/jdk/pull/13180#discussion_r1148808588
PR Review Comment: https://git.openjdk.org/jdk/pull/13180#discussion_r1148811223
More information about the build-dev
mailing list