From d0fe8f7ede7c2426438c7d6dc5a24cfd2f1d094e Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 22 Sep 2025 21:03:15 +0000 Subject: [PATCH] 8368312: Move CC_OUT_OPTION out of spec.gmk Reviewed-by: erikj --- make/Hsdis.gmk | 1 - make/autoconf/flags.m4 | 8 +------- make/autoconf/spec.gmk.template | 1 - make/common/native/CompileFile.gmk | 12 ++++++++++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/make/Hsdis.gmk b/make/Hsdis.gmk index a0fc031be1b..469cc488f16 100644 --- a/make/Hsdis.gmk +++ b/make/Hsdis.gmk @@ -114,7 +114,6 @@ ifeq ($(HSDIS_BACKEND), binutils) TOOLCHAIN_TYPE := gcc OPENJDK_TARGET_OS := linux OPENJDK_TARGET_OS_TYPE := unix - CC_OUT_OPTION := -o$(SPACE) GENDEPS_FLAGS := -MMD -MF CFLAGS_DEBUG_SYMBOLS := -g DISABLED_WARNINGS := diff --git a/make/autoconf/flags.m4 b/make/autoconf/flags.m4 index 10647305757..c47947154c2 100644 --- a/make/autoconf/flags.m4 +++ b/make/autoconf/flags.m4 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -319,16 +319,10 @@ AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN], AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL], [ if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then - CC_OUT_OPTION=-Fo if test "x$OPENJDK_TARGET_CPU" != xaarch64; then AS_NON_ASM_EXTENSION_OPTION=-Ta fi - else - # The option used to specify the target .o,.a or .so file. - # When compiling, how to specify the to be created object file. - CC_OUT_OPTION='-o$(SPACE)' fi - AC_SUBST(CC_OUT_OPTION) AC_SUBST(AS_NON_ASM_EXTENSION_OPTION) # Generate make dependency files diff --git a/make/autoconf/spec.gmk.template b/make/autoconf/spec.gmk.template index 4eb5aa2f66d..e2e8b24db6e 100644 --- a/make/autoconf/spec.gmk.template +++ b/make/autoconf/spec.gmk.template @@ -491,7 +491,6 @@ CXX_VERSION_NUMBER := @CXX_VERSION_NUMBER@ # Legacy support HOTSPOT_TOOLCHAIN_TYPE := @HOTSPOT_TOOLCHAIN_TYPE@ -CC_OUT_OPTION := @CC_OUT_OPTION@ AS_NON_ASM_EXTENSION_OPTION := @AS_NON_ASM_EXTENSION_OPTION@ # Flags used for overriding the default opt setting for a C/C++ source file. diff --git a/make/common/native/CompileFile.gmk b/make/common/native/CompileFile.gmk index a8d46949788..10326d3066c 100644 --- a/make/common/native/CompileFile.gmk +++ b/make/common/native/CompileFile.gmk @@ -93,6 +93,14 @@ DEPENDENCY_TARGET_SED_PATTERN := \ -e 's/$$$$/ :/' \ # +################################################################################ +# Setup compiler-specific argument to specify output file +ifeq ($(call isCompiler, microsoft), true) + CC_OUT_OPTION := -Fo +else + CC_OUT_OPTION := -o$(SPACE) +endif + ################################################################################ # Create the recipe needed to compile a single native source file. # @@ -334,7 +342,7 @@ define CreateWindowsResourceFile $$(call LogInfo, Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$($1_BASENAME))) $$(call MakeDir, $$(@D) $$($1_OBJECT_DIR)) $$(call ExecuteWithLog, $$@, $$(call MakeCommandRelative, \ - $$($1_RC) $$($1_RCFLAGS) $$($1_SYSROOT_CFLAGS) $(CC_OUT_OPTION)$$@ \ + $$($1_RC) $$($1_RCFLAGS) $$($1_SYSROOT_CFLAGS) -Fo$$@ \ $$($1_VERSIONINFO_RESOURCE) 2>&1 )) # Windows RC compiler does not support -showIncludes, so we mis-use CL # for this. Filter out RC specific arguments that are unknown to CL. @@ -344,7 +352,7 @@ define CreateWindowsResourceFile $$(call ExecuteWithLog, $$($1_RES_DEPS_FILE)$(OBJ_SUFFIX), \ $$($1_CC) $$(filter-out -l%, $$($1_RCFLAGS)) \ $$($1_SYSROOT_CFLAGS) -showIncludes -nologo -TC \ - $(CC_OUT_OPTION)$$($1_RES_DEPS_FILE)$(OBJ_SUFFIX) -P -Fi$$($1_RES_DEPS_FILE).pp \ + -Fo$$($1_RES_DEPS_FILE)$(OBJ_SUFFIX) -P -Fi$$($1_RES_DEPS_FILE).pp \ $$($1_VERSIONINFO_RESOURCE)) 2>&1 \ | $(TR) -d '\r' | $(GREP) -v -e "^Note: including file:" \ -e "^$$(notdir $$($1_VERSIONINFO_RESOURCE))$$$$" || test "$$$$?" = "1" ; \