RFR: 8326587: Separate out Microsoft toolchain linking [v4]

Magnus Ihse Bursie ihse at openjdk.org
Tue Feb 27 11:08:48 UTC 2024


On Tue, 27 Feb 2024 11:04:49 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

>> I tend to agree, this should not have been changed to specifying -o directly. We generally keep options inside Makefile variables rather than directly passing them like this, much like how $(OBJ_SUFFIX) was recently used to replace directly specifying the object file suffix in the make system
>
> This was actually an important part of this PR, trying to combat the all too general solution we had when trying to combine microsoft and non-microsoft linking. On all Unix-style linkers, the option to mark the output file is `-o `. That is such a fundemental option that we do not want to make it general, especially not considering the additional difficulty that the corresponding option for the microsoft `link.exe` is to specify `/out:<filename>`, without a space. This forced us to define LD_OUT_OPTION as `-o$(SPACE)` on unix linkers, and it forced us to setup the linker command line with `$(LD_OUT_OPTION)$$($1_TARGET_RELOCATABLE)` with no space between. 
> 
> That is in clear contrast with how we can add multiple sets of command line options like e.g. `(LDFLAGS_CXX_PARTIAL_LINKING) $$($1_SYSROOT_LDFLAGS)` where we can just stack them after each other with a space between.

Also, 

> the flexibility of specifying the non-linker specific option here

I don't know what you mean by that. LD_OUT_OPTION was thought of as an abstraction between the difference of `-o ` and `/out:`. It should not be used to include anything else, so no flexibility is lost.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17987#discussion_r1504051487


More information about the build-dev mailing list