In [JDK-8371626](https://bugs.openjdk.org/browse/JDK-8371626) a new linker flag was introduced that only works with the Gold linker. The way the flag is added is not compatible with cross compilation configurations where the "build JDK" is built on the fly. In such a configuration, we are setting up two distinct toolchains, the TARGET (basically the regular one, with no variable prefixes) and the BUILD (an extra toolchain used to compile for the build platform, variables have the prefix "BUILD_").
This patch adjusts the adding of this linker flag so that it's conditionally added to each of the BUILD and TARGET linker flags depending on if the corresponding toolchain is using the Gold linker. I have verified with local builds, both native and cross, both that the builds succeed and that the expected flag is added when it should be. I've also run the full set of automated builds in our internal build and test system. ------------- Commit messages: - JDK-8372705 Changes: https://git.openjdk.org/jdk/pull/28619/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28619&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8372705 Stats: 15 lines in 2 files changed: 7 ins; 5 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/28619.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/28619/head:pull/28619 PR: https://git.openjdk.org/jdk/pull/28619
