[jdk8u-dev] RFR: 8374899: [8u] Fully handle clang as the toolchain in flags.m4 [v3]

Sergey Bylokhov serb at openjdk.org
Sun Jan 18 23:11:54 UTC 2026


On Mon, 12 Jan 2026 23:52:28 GMT, Andrew John Hughes <andrew at openjdk.org> wrote:

>> 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 four additional commits since the last revision:
> 
>  - 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

Marked as reviewed by serb (Reviewer).

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

PR Review: https://git.openjdk.org/jdk8u-dev/pull/740#pullrequestreview-3675826395


More information about the jdk8u-dev mailing list