[jdk8u-dev] RFR: 8374899: [8u] Fully handle clang as the toolchain in flags.m4 [v5]
Andrew John Hughes
andrew at openjdk.org
Thu Jan 29 17:32:42 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
- Merge remote-tracking branch 'dev/master' into JDK-8374899
- Revert "Add LOG_LEVEL=debug to all GHA builds"
This reverts commit a58971d6c8b1b385529d905fbaca6521938e2f71.
- Merge remote-tracking branch 'dev/master' into JDK-8374899
- Print spec files on all POSIX platforms
- Add LOG_LEVEL=debug to all GHA builds
- Whitespace cleanup
- 8374899: [8u] Fully handle clang as the toolchain in flags.m4
-------------
Changes:
- all: https://git.openjdk.org/jdk8u-dev/pull/740/files
- new: https://git.openjdk.org/jdk8u-dev/pull/740/files/10c81342..3fd8a886
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk8u-dev&pr=740&range=04
- incr: https://webrevs.openjdk.org/?repo=jdk8u-dev&pr=740&range=03-04
Stats: 84 lines in 7 files changed: 78 ins; 0 del; 6 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