[jdk8u-dev] RFR: 8374899: [8u] Fully handle clang as the toolchain in flags.m4 [v2]
Andrew John Hughes
andrew at openjdk.org
Fri Jan 9 16:25:28 UTC 2026
> There are a number of cases in `flags.m4` where the toolchain is checked and `clang` (now the default on all supported versions of XCode on MacOS) is not handled. In particular, this means `-std=gnu++98` is never added and [attempts to build with MacOS 15](https://github.com/openjdk/jdk8u-dev/pull/738) fail as it is trying to meet the demands of C++11.
>
> This PR updates the file to handle clang with gcc in most places as there is more commonality between the two than difference. It doesn't attempt to remove the gcc on MacOS support and so some areas will differ from 11u and later where MacOS is assumed to be clang-only.
>
> The changes are as follows:
>
> 1. Handle linker flags under one shared gcc & clang block as there is mostly duplication between the two with the only difference being `PICFLAG` and `PIEFLAG`.
> 2. Handle the `-O` flag for both gcc & clang together as they only differ by OS.
> 3. Handle `clang` in `FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK`
> 4. Move the Linux defines (`-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE`) to where the BSD, MacOS & AIX ones are added. This presumably means these were not previously being added for Linux on clang. This mirrors 11u handling.
>
> The changes in #3 mean that clang builds will now run the compiler tests for `-std=gnu++98`, `-Wformat-overflow` and `-ffp-contract` as well as the warning & `-fstack-protector` flags added in this block. Some of this may need to be exempted depending on testing.
>
> As MacOS GHA builds do not currently run, I will make #738 depend on this PR to test there.
>
> This also adds `LOG_LEVEL=debug` to the remaining OpenJDK GHA builds where it was absent (x86 Linux, Windows & Mac). This will mean noisier logs, but more useful ones when there is actually a failure. The current failing Mac ones don't tell us the commands being passed to the compiler. The same option has been present for x86_64 and alt Linux builds for some time.
Andrew John Hughes has updated the pull request incrementally with one additional commit since the last revision:
Helps if configure is regenerated
-------------
Changes:
- all: https://git.openjdk.org/jdk8u-dev/pull/740/files
- new: https://git.openjdk.org/jdk8u-dev/pull/740/files/a89902a9..a363af1d
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk8u-dev&pr=740&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk8u-dev&pr=740&range=00-01
Stats: 120 lines in 1 file changed: 8 ins; 31 del; 81 mod
Patch: https://git.openjdk.org/jdk8u-dev/pull/740.diff
Fetch: git fetch https://git.openjdk.org/jdk8u-dev.git pull/740/head:pull/740
PR: https://git.openjdk.org/jdk8u-dev/pull/740
More information about the jdk8u-dev
mailing list