RFR: 8345265: Fix gcc LTO without disabling LTO for g1ParScanThreadState.cpp

Julian Waters jwaters at openjdk.org
Sat Nov 30 00:47:53 UTC 2024


fixed LTO for gcc when compiling for platforms where the FORBID_C_FUNCTION mechanism is active, however the fix does so by inhibiting LTO for a specific file. This can hinder optimization, which is the end goal if one is indeed doing an LTO build. Fix the issue in a different way by disabling FORBID_C_FUNCTION entirely for os.cpp, which is where the error originates. This has a wide downstream effect, as os.cpp contains a call to os::malloc which contains the forbidden malloc that causes errors that cannot be suppressed by ALLOW_C_FUNCTION in an LTO build. This is a stopgap fix until FORBID_C_FUNCTION is fixed to work properly with LTO on all platforms. While here, also fix a memory leak in jvmciEnv.cpp

-------------

Commit messages:
 - Fix memory leak in jvmciEnv.cpp
 - Stopgap fix in os.cpp
 - Declaration fix in compilerWarnings_gcc.hpp
 - DISABLE_POISONING_STOPGAP in compilerWarnings_gcc.hpp
 - 8345265

Changes: https://git.openjdk.org/jdk/pull/22464/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22464&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8345265
  Stats: 10 lines in 4 files changed: 3 ins; 4 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/22464.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22464/head:pull/22464

PR: https://git.openjdk.org/jdk/pull/22464


More information about the build-dev mailing list