RFR: 8328157: Move C[XX]FLAGS_JDK[LIB/EXE] to JdkNativeCompilation.gmk [v3]

Magnus Ihse Bursie ihse at openjdk.org
Fri Mar 15 12:41:38 UTC 2024


On Thu, 14 Mar 2024 19:45:10 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> Magnus Ihse Bursie has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix syntax error
>
> make/modules/jdk.jpackage/Lib.gmk line 63:
> 
>> 61:     CXXFLAGS_FILTER_OUT := -MD, \
>> 62:     CXXFLAGS := $(JPACKAGE_APPLAUNCHER_INCLUDES), \
>> 63:     CFLAGS := $(JPACKAGE_APPLAUNCHER_INCLUDES), \
> 
> This removed `-MD`, but I don't see it adding `-MT`.

You are correct, this is missing in several places. 

I got curious on how this could still end up making no difference in the resulting binary, and I ended up in a deep google rabbit hole. My understanding is that `/MT` is in effect default, but Microsoft does not say that. Instead, they say that setting `/MT` makes the library link with `libcmt.lib` (and define `_MT`), but not setting any of `/MT` or `/MD` will result in your code linking with `libcmt.lib` by default... So if you don't look for the `_MT` define, there is no difference in the output. 

Nevertheless, we should have the option for clarity of what we mean.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18301#discussion_r1526230055


More information about the build-dev mailing list