diff options
author | snermolaev <snermolaev@yandex-team.ru> | 2022-02-10 16:45:53 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:53 +0300 |
commit | 2015790ac9fcc04caab83fccc23ab2460310a797 (patch) | |
tree | e644e9bc3f6f688561a871793b59bf8a637e0f72 /build/conf | |
parent | c768a99151e47c3a4bb7b92c514d256abd301c4d (diff) | |
download | ydb-2015790ac9fcc04caab83fccc23ab2460310a797.tar.gz |
Restoring authorship annotation for <snermolaev@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build/conf')
-rw-r--r-- | build/conf/compilers/gnu_compiler.conf | 940 | ||||
-rw-r--r-- | build/conf/compilers/msvc_compiler.conf | 588 | ||||
-rw-r--r-- | build/conf/java.ymake.conf | 2 | ||||
-rw-r--r-- | build/conf/linkers/ld.conf | 766 | ||||
-rw-r--r-- | build/conf/linkers/msvc_linker.conf | 542 | ||||
-rw-r--r-- | build/conf/project_specific/maps/mapkit.conf | 2 | ||||
-rw-r--r-- | build/conf/settings.conf | 302 | ||||
-rw-r--r-- | build/conf/toolchains/msvc_toolchain.conf | 14 |
8 files changed, 1578 insertions, 1578 deletions
diff --git a/build/conf/compilers/gnu_compiler.conf b/build/conf/compilers/gnu_compiler.conf index 373be5bedd..67ff2f4d0c 100644 --- a/build/conf/compilers/gnu_compiler.conf +++ b/build/conf/compilers/gnu_compiler.conf @@ -1,470 +1,470 @@ -_C_DEFINES_ANDROID= -_C_DEFINES_ANDROID_OTHERWISE= -when ($OS_ANDROID == "yes") { - _C_DEFINES_ANDROID=-DANDROID_FAKEID=$ANDROID_FAKEID -} -otherwise { - # There is no usable _FILE_OFFSET_BITS=64 support in Androids until API 21. And it's incomplete until at least API 24. - # https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md - # Arcadia have API 16 for 32-bit Androids. - _C_DEFINES_ANDROID_OTHERWISE=-D_FILE_OFFSET_BITS=64 -} - -_C_DEFINES_GNU_SOURCE= -when ($OS_LINUX == "yes" || $OS_ANDROID == "yes" || $OS_CYGWIN == "yes") { - _C_DEFINES_GNU_SOURCE=-D_GNU_SOURCE -} - -_C_DEFINES_CLANG_LINUX_X86_64= -when ($CLANG == "yes" && $OS_LINUX == "yes" && $ARCH_X86_64 == "yes") { - _C_DEFINES_CLANG_LINUX_X86_64=-D_YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE -} - -_C_DEFINES_IOS= -when ($OS_IOS == "yes") { - _C_DEFINES_IOS=-D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -} - -_C_DEFINES_WITH_VALGRIND= -when ($WITH_VALGRIND == "yes") { - _C_DEFINES_WITH_VALGRIND=-DWITH_VALGRIND=1 -} - -C_DEFINES =-DFAKEID=$CPP_FAKEID -C_DEFINES+=$_C_DEFINES_ANDROID -C_DEFINES+=\ --DARCADIA_ROOT=${ARCADIA_ROOT} \ --DARCADIA_BUILD_ROOT=${ARCADIA_BUILD_ROOT} \ --D_THREAD_SAFE \ --D_PTHREADS \ --D_REENTRANT \ --D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES \ --D_LARGEFILE_SOURCE \ --D__STDC_CONSTANT_MACROS \ --D__STDC_FORMAT_MACROS -C_DEFINES+=$_C_DEFINES_ANDROID_OTHERWISE -C_DEFINES+=$_C_DEFINES_GNU_SOURCE -C_DEFINES+=$_C_DEFINES_CLANG_LINUX_X86_64 -C_DEFINES+=$_C_DEFINES_IOS -C_DEFINES+=$_C_DEFINES_WITH_VALGRIND -C_DEFINES+=$_C_DEFINES_NDEBUG - -_C_FOPTIONS_INIT_ARRAY= -when ($CLANG == "yes" && $OS_LINUX == "yes") { - # Use .init_array instead of .ctors (default for old clang versions) - # See: https://maskray.me/blog/2021-11-07-init-ctors-init-array - _C_FOPTIONS_INIT_ARRAY=-fuse-init-array -} - -_C_FOPTIONS_COLOR= -_C_FOPTIONS_ALIGNED_ALLOCATION= -when ($CLANG == "yes") { - # Set up output colorization - _C_FOPTIONS_COLOR=-fcolor-diagnostics - # Enable aligned allocation - _C_FOPTIONS_ALIGNED_ALLOCATION=-faligned-allocation -} -elsewhen ($GCC == "yes") { - # Set up output colorization - _C_FOPTIONS_COLOR=-fdiagnostics-color=always - # It looks like there is no way to enable aligned allocation in gcc -} - -_C_FOPTIONS_MAPSMOBI_ARM= -when ($OS_IOS == "yes") { - when ($MAPSMOBI_BUILD_TARGET == "yes" && $ARCH_ARM == "yes") { - _C_FOPTIONS_MAPSMOBI_ARM=-fembed-bitcode - } -} - -_C_WARNINGS_CLANG= -_CXX_WARNINGS_CLANG= -when ($CLANG == "yes") { - - _CXX_WARNINGS_CLANG=\ --Wimport-preprocessor-directive-pedantic \ --Wno-undefined-var-template \ --Wno-return-std-move \ --Wno-address-of-packed-member \ --Wno-defaulted-function-deleted \ --Wno-pessimizing-move \ --Wno-range-loop-construct \ --Wno-deprecated-anon-enum-enum-conversion \ --Wno-deprecated-enum-enum-conversion \ --Wno-deprecated-enum-float-conversion \ --Wno-ambiguous-reversed-operator \ --Wno-deprecated-volatile - -# -Wno-unknown-warning-option -# For nvcc to accept the above. - _C_WARNINGS_CLANG=\ --Wno-implicit-const-int-float-conversion \ --Wno-unknown-warning-option - -} - -_C_FOPTIONS_GCC= -when ($GCC == "yes") { - _C_FOPTIONS_GCC=-fno-delete-null-pointer-checks -fabi-version=8 -} - -_C_FOPTIONS_IOS= -when ($OS_IOS != "yes") { - # Split all functions and data into separate sections for DCE and ICF linker passes - # NOTE: iOS build uses -fembed-bitcode which conflicts with -ffunction-sections (only relevant for ELF targets) - _C_FOPTIONS_IOS=-ffunction-sections -fdata-sections -} - -_C_FOPTIONS_DEBUG= -when ($_BUILD_DEBUG == "yes") { - _C_FOPTIONS_DEBUG=$FSTACK -} - -_C_FLAGS_RELEASE= -_C_FOPTIONS_RELEASE= -_OPTIMIZE_RELEASE= -when ($_BUILD_RELEASE == "yes") { - _C_FLAGS_RELEASE=$OPTIMIZE - when ($_BUILD_SIZE_OPTIMIZED == "yes") { - # -Oz is clang's more size-aggressive version of -Os - # For ARM specifically, clang -Oz is on par with gcc -Os: - # https://github.com/android/ndk/issues/133#issuecomment-365763507 - when($CLANG == "yes") { - _OPTIMIZE_RELEASE=-Oz - } - otherwise { - _OPTIMIZE_RELEASE=-Os - } - - # Generate sections with address significance tables for ICF linker pass - when($CLANG == "yes") { - _C_FOPTIONS_RELEASE=-faddrsig - } - } - otherwise { - _OPTIMIZE_RELEASE=-O3 - } -} - -_C_FOPTIONS_PROFILER= -when ($_BUILD_PROFILER_TYPE != "") { - when ($_BUILD_PROFILER_TYPE in ["generic", "gprof"]) { - _C_FOPTIONS_PROFILER=-fno-omit-frame-pointer - } -} - -_C_FOPTIONS = - -# Enable C++ exceptions (and allow them to be throw through pure C code) -_C_FOPTIONS+=-fexceptions - -# Enable standard-conforming behavior and generate duplicate symbol error in case of duplicated global constants. -# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678#c0 -_C_FOPTIONS+=-fno-common - -_C_FOPTIONS+=$_C_FOPTIONS_INIT_ARRAY -_C_FOPTIONS+=$_C_FOPTIONS_COLOR -_C_FOPTIONS+=$_C_FOPTIONS_ALIGNED_ALLOCATION -_C_FOPTIONS+=$_C_FOPTIONS_MAPSMOBI_ARM -_C_FOPTIONS+=$_C_FOPTIONS_DEBUG -_C_FOPTIONS+=$_C_FOPTIONS_RELEASE -_C_FOPTIONS+=$_C_FOPTIONS_PROFILER -_C_FOPTIONS+=$_C_FOPTIONS_GCC -_C_FOPTIONS+=$_C_FOPTIONS_IOS - -# Enable default warnings subset -_C_WARNINGS =-Wall -Wextra - -# Disable some warnings which will fail compilation at the time -_C_WARNINGS+=-Wno-parentheses - -_C_WARNINGS+=$_C_WARNINGS_CLANG - -# Issue a warning if certain overload is hidden due to inheritance -_CXX_WARNINGS =-Woverloaded-virtual - -_CXX_WARNINGS+=$_CXX_WARNINGS_CLANG - -_C_FLAGS_ARCH= -when ($ARCH_I386 == "yes") { - _C_FLAGS_ARCH=-m32 -} -when ($ARCH_X86_64 == "yes") { - _C_FLAGS_ARCH=-m64 -} - -_C_FLAGS_FAST_DEBUG= -when ($_BUILD_FAST_DEBUG == "yes") { - _C_FLAGS_FAST_DEBUG=-Og -} - -_C_DEFINES_NDEBUG=-UNDEBUG -when ($_BUILD_WITH_NDEBUG == "yes") { - _C_DEFINES_NDEBUG=-DNDEBUG -} - -_C_FLAGS_PROFILER= -when ($_BUILD_PROFILER_TYPE == "gprof") { - _C_FLAGS_PROFILER=-pg -} - -_C_FLAGS=\ -$CL_DEBUG_INFO $CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__ $_C_FLAGS_ARCH_OPT -pipe -_C_FLAGS+=$_C_FLAGS_ARCH -_C_FLAGS+=$_C_FLAGS_FAST_DEBUG -_C_FLAGS+=$_C_FLAGS_RELEASE -_C_FLAGS+=$_C_FLAGS_PROFILER - -_SFDL_FLAGS=-E -C -x c++ -when ($CLANG == "yes") { - _SFDL_FLAGS+=-Qunused-arguments -} - -_DEBUG_INFO_FLAGS=-g -when ($OS_LINUX == "yes") { - _DEBUG_INFO_FLAGS=-g -ggnu-pubnames -} - -_CROSS_SUFFIX=.pic -when ($FORCE_NO_PIC == "yes") { - _CROSS_SUFFIX= -} - -C_COMPILER=${quo:C_COMPILER_UNQUOTED} -OPTIMIZE=$_OPTIMIZE_RELEASE -FSTACK=-fstack-protector -DUMP_DEPS= -GCC_PREPROCESSOR_OPTS=$DUMP_DEPS $C_DEFINES -C_WARNING_OPTS=$_C_WARNINGS -CXX_WARNING_OPTS=$_CXX_WARNINGS - -# PIE is only valid for executables, while PIC implies a shared library -# `-pie` with a shared library is either ignored or fails to link -when ($PIC == "yes") { - CFLAGS+=-fPIC - LDFLAGS+=-fPIC -} -elsewhen ($PIE == "yes") { - CFLAGS+=-fPIE - LDFLAGS+=-fPIE -pie -} - -CFLAGS+=$_C_FLAGS $DEBUG_INFO_FLAGS $_C_FOPTIONS $C_WARNING_OPTS $GCC_PREPROCESSOR_OPTS $USER_CFLAGS $USER_CFLAGS_GLOBAL -CXXFLAGS+=$CFLAGS $_CXX_STD $CXX_WARNING_OPTS $USER_CXXFLAGS $USER_CXXFLAGS_GLOBAL -CONLYFLAGS+=$USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL -CXX_COMPILER=${quo:CXX_COMPILER_UNQUOTED} -NOGCCSTACKCHECK=yes -SFDL_FLAG=$_SFDL_FLAGS -o $SFDL_TMP_OUT -WERROR_FLAG=-Werror -DEBUG_INFO_FLAGS=$_DEBUG_INFO_FLAGS - -when ($NO_WSHADOW == "yes") { - C_WARNING_OPTS += -Wno-shadow -} -when ($NO_COMPILER_WARNINGS == "yes") { - C_WARNING_OPTS = -w - CXX_WARNING_OPTS = -Wno-everything -} -when ($NO_OPTIMIZE == "yes") { - OPTIMIZE = -O0 -} -when ($SAVE_TEMPS == "yes") { - CXXFLAGS += -save-temps -} -when ($NOGCCSTACKCHECK != "yes") { - FSTACK += -fstack-check -} - -# _C_DEBUG_LIGHT=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B -# _C_DEBUG_LIGHT_CL=$_C_DEBUG_LIGHT -Xclang -fdebug-compilation-dir -Xclang /tmp -# _C_DEBUG=$_C_DEBUG_LIGHT -fdebug-prefix-map=${ARCADIA_ROOT}=/-S -fdebug-prefix-map=$(TOOL_ROOT)=/-T -# _C_DEBUG_CL=$_C_DEBUG -Xclang -fdebug-compilation-dir -Xclang /tmp -# _YASM_DEBUG_LIGHT=--replace=${ARCADIA_BUILD_ROOT}=/-B -# _YASM_DEBUG=$_YASM_DEBUG_LIGHT --replace=${ARCADIA_ROOT}=/-S --replace=$(TOOL_ROOT)=/-T -# when ($FORCE_CONSISTENT_DEBUG == "yes") { -# when ($CLANG == "yes") { -# CL_DEBUG_INFO=$_C_DEBUG_CL -# } -# otherwise { -# CL_DEBUG_INFO=$_C_DEBUG -# } -# YASM_DEBUG_INFO=$_YASM_DEBUG -# } -# elsewhen ($CONSISTENT_DEBUG == "yes") { -# when ($CLANG == "yes") { -# CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=$_C_DEBUG_CL -# } -# otherwise { -# CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=$_C_DEBUG -# } -# YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=$_YASM_DEBUG -# } -# elsewhen ($CONSISTENT_DEBUG_LIGHT == "yes") { -# when ($CLANG == "yes") { -# CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=$_C_DEBUG_LIGHT_CL -# } -# otherwise { -# CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=$_C_DEBUG_LIGHT -# } -# YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=$_YASM_DEBUG_LIGHT -# } -# -# _C_BUILTINS=-Wno-builtin-macro-redefined -D__DATE__="\"""Sep 31 2019""\"" -D__TIME__=\"00:00:00\" -# when ($CLANG == "yes" && $_TC_VERSION_AT_LEAST_10 || $GCC == "yes" && $_TC_VERSION_AT_LEAST_8 == "yes") { -# # XXX does not support non-normalized paths -# _C_BUILTINS+=-fmacro-prefix-map=${ARCADIA_BUILD_ROOT}/= -fmacro-prefix-map=${ARCADIA_ROOT}/= -fmacro-prefix-map=$(TOOL_ROOT)/= -# } -# otherwise { -# # XXX this macro substitution breaks __FILE__ in included sources -# _C_BUILTINS+=-D__FILE__=\"${input;qe;rootrel:SRC}\" -# } -# -# when ($FORCE_CONSISTENT_BUILD == "yes") { -# CL_MACRO_INFO=$_C_BUILTINS -# } -# elsewhen ($CONSISTENT_BUILD == "yes") { -# CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=$_C_BUILTINS -# } - -when ($FORCE_CONSISTENT_DEBUG == "yes") { - when ($CLANG == "yes") { - CL_DEBUG_INFO=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B -fdebug-prefix-map=${ARCADIA_ROOT}=/-S -fdebug-prefix-map=$(TOOL_ROOT)=/-T -Xclang -fdebug-compilation-dir -Xclang /tmp - } - otherwise { - CL_DEBUG_INFO=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B -fdebug-prefix-map=${ARCADIA_ROOT}=/-S -fdebug-prefix-map=$(TOOL_ROOT)=/-T - } - YASM_DEBUG_INFO=--replace=${ARCADIA_BUILD_ROOT}=/-B --replace=${ARCADIA_ROOT}=/-S --replace=$(TOOL_ROOT)=/-T -} -elsewhen ($CONSISTENT_DEBUG == "yes") { - when ($CLANG == "yes") { - CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B -fdebug-prefix-map=${ARCADIA_ROOT}=/-S -fdebug-prefix-map=$(TOOL_ROOT)=/-T -Xclang -fdebug-compilation-dir -Xclang /tmp - } - otherwise { - CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B -fdebug-prefix-map=${ARCADIA_ROOT}=/-S -fdebug-prefix-map=$(TOOL_ROOT)=/-T - } - YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=--replace=${ARCADIA_BUILD_ROOT}=/-B --replace=${ARCADIA_ROOT}=/-S --replace=$(TOOL_ROOT)=/-T -} -elsewhen ($CONSISTENT_DEBUG_LIGHT == "yes") { - when ($CLANG == "yes") { - CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B -Xclang -fdebug-compilation-dir -Xclang /tmp - } - otherwise { - CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B - } - YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=--replace=${ARCADIA_BUILD_ROOT}=/-B -} - -when ($FORCE_CONSISTENT_BUILD == "yes") { - CL_MACRO_INFO=-Wno-builtin-macro-redefined -D__DATE__=\""Sep 31 2019\"" -D__TIME__=\"00:00:00\" -fmacro-prefix-map=${ARCADIA_BUILD_ROOT}/= -fmacro-prefix-map=${ARCADIA_ROOT}/= -fmacro-prefix-map=$(TOOL_ROOT)/= -} -elsewhen ($CONSISTENT_BUILD == "yes") { - CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=-Wno-builtin-macro-redefined -D__DATE__=\""Sep 31 2019\"" -D__TIME__=\"00:00:00\" -fmacro-prefix-map=${ARCADIA_BUILD_ROOT}/= -fmacro-prefix-map=${ARCADIA_ROOT}/= -fmacro-prefix-map=$(TOOL_ROOT)/= -} - -_CFLAGS_ARCH_I386= -when ($ARCH_I386 == "yes" && $ARCH_I686 != "yes") { - _CFLAGS_ARCH_I386=-march=pentiumpro -mtune=pentiumpro -} - -CFLAGS+=$_CFLAGS_ARCH_I386 - -BC_CFLAGS+=$CFLAGS -BC_CXXFLAGS+=$CXXFLAGS -C_DEFINES+=-D__LONG_LONG_SUPPORTED - -OBJ_CROSS_SUF=$OBJ_SUF$_CROSS_SUFFIX -OBJECT_SUF=$OBJ_SUF$_CROSS_SUFFIX.o -GCC_COMPILE_FLAGS=$EXTRA_C_FLAGS -c -o $_COMPILE_OUTPUTS ${pre=-I:_C__INCLUDE} -EXTRA_COVERAGE_OUTPUT=${output;noauto;hide;suf=${OBJECT_SUF}.gcno:SRC} -CLANG_TIDY_OUTPUT_FILE=${output;noauto;suf=${OBJECT_SUF}.tidyjson:SRC} -YNDEXER_OUTPUT_FILE=${output;noauto;suf=${OBJECT_SUF}.ydx.pb2:SRC} - -when ($DUMP_COMPILER_DEPS == "yes") { - DUMP_DEPS=-MD ${output;hide;noauto;suf=${OBJ_SUF}.o.d:SRC} -} -elsewhen ($DUMP_COMPILER_DEPS_FAST == "yes") { - DUMP_DEPS=-E -M -MF ${output;noauto;suf=${OBJ_SUF}.o.d:SRC} -} - -_COMPILER_TIME_TRACE_GRANULARITY=500 -when ($TIME_TRACE_GRANULARITY && $TIME_TRACE_GRANULARITY != "") { - _COMPILER_TIME_TRACE_GRANULARITY=$TIME_TRACE_GRANULARITY -} - -_COMPILER_TIME_TRACE_FLAGS= -_COMPILER_TIME_TRACE_POSTPROCESS= -when (($TIME_TRACE == "yes" || $COMPILER_TIME_TRACE == "yes") && $CLANG == "yes" && $_TC_VERSION_AT_LEAST_9 == "yes") { - _COMPILER_TIME_TRACE_FLAGS=-ftime-trace -ftime-trace-granularity=$_COMPILER_TIME_TRACE_GRANULARITY - _COMPILER_TIME_TRACE_POSTPROCESS=$YMAKE_PYTHON ${input:"build/scripts/find_time_trace.py"} $_COMPILE_OUTPUTS $_COMPILE_TIME_TRACE_OUTPUTS -} - -_C_CPP_KV_STYLE=${requirements;hide:CC_REQUIREMENTS} ${hide;kv:"p CC"} ${hide;kv:"pc green"} -_CPP_ARGS=\ -$CLANG_TIDY_ARGS \ -$YNDEXER_ARGS \ -$CXX_COMPILER \ -$C_FLAGS_PLATFORM \ -$GCC_COMPILE_FLAGS \ -$CXXFLAGS \ -$CL_MACRO_INFO \ -$CL_MACRO_INFO_DISABLE_CACHE__NO_UID__ \ -$_COMPILER_TIME_TRACE_FLAGS \ -$EXTRA_OUTPUT \ -$SRCFLAGS \ -$_LANG_CFLAGS_VALUE \ -${input:SRC} \ -$TOOLCHAIN_ENV \ -$YNDEXER_OUTPUT \ -&& $_COMPILER_TIME_TRACE_POSTPROCESS \ -$_C_CPP_KV_STYLE - -_C_ARGS=\ -$CLANG_TIDY_ARGS \ -$YNDEXER_ARGS \ -$C_COMPILER \ -$C_FLAGS_PLATFORM \ -$GCC_COMPILE_FLAGS \ -$CFLAGS \ -$CL_MACRO_INFO \ -$CL_MACRO_INFO_DISABLE_CACHE__NO_UID__ \ -$_COMPILER_TIME_TRACE_FLAGS \ -$CONLYFLAGS \ -$EXTRA_OUTPUT \ -$SRCFLAGS \ -${input:SRC} \ -$TOOLCHAIN_ENV \ -$YNDEXER_OUTPUT \ -$_C_CPP_KV_STYLE - -### _SRC_C_NODEPS_CMD is obtained from _C_ARGS by filtering the following elements: -### ${input:SRC} -### $CL_MACRO_INFO -### $CL_MACRO_INFO_DISABLE_CACHE__NO_UID__ -### $CLANG_TIDY_ARGS -### $EXTRA_OUTPUT -### $EXTRA_COVERAGE_OUTPUT -### $SRCFLAGS -### $YNDEXER_ARGS -### $YNDEXER_OUTPUT -### -### $GCC_COMPILE_FLAGS is substituted for $EXTRA_C_FLAGS -c -o ${OUTFILE} ${SRC} ${pre=-I:INC} -_SRC_C_NODEPS_CMD=\ -$C_COMPILER \ -$C_FLAGS_PLATFORM \ -$EXTRA_C_FLAGS -c -o ${OUTFILE} ${SRC} ${pre=-I:INC} \ -$CFLAGS \ -$CONLYFLAGS \ -$TOOLCHAIN_ENV \ -$_C_CPP_KV_STYLE - -_SRC_CPP_CMD=$_CPP_ARGS -_SRC_C_CMD=$_C_ARGS -_SRC_M_CMD=$SRC_c($SRC $SRCFLAGS) -_SRC_MASM_CMD=$_EMPTY_CMD - -# fuzzing configuration -when ($CLANG == "yes") { - when ($_TC_VERSION_AT_LEAST_12 == "yes") { - LIBFUZZER_PATH=contrib/libs/libfuzzer12 - } -} +_C_DEFINES_ANDROID= +_C_DEFINES_ANDROID_OTHERWISE= +when ($OS_ANDROID == "yes") { + _C_DEFINES_ANDROID=-DANDROID_FAKEID=$ANDROID_FAKEID +} +otherwise { + # There is no usable _FILE_OFFSET_BITS=64 support in Androids until API 21. And it's incomplete until at least API 24. + # https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md + # Arcadia have API 16 for 32-bit Androids. + _C_DEFINES_ANDROID_OTHERWISE=-D_FILE_OFFSET_BITS=64 +} + +_C_DEFINES_GNU_SOURCE= +when ($OS_LINUX == "yes" || $OS_ANDROID == "yes" || $OS_CYGWIN == "yes") { + _C_DEFINES_GNU_SOURCE=-D_GNU_SOURCE +} + +_C_DEFINES_CLANG_LINUX_X86_64= +when ($CLANG == "yes" && $OS_LINUX == "yes" && $ARCH_X86_64 == "yes") { + _C_DEFINES_CLANG_LINUX_X86_64=-D_YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE +} + +_C_DEFINES_IOS= +when ($OS_IOS == "yes") { + _C_DEFINES_IOS=-D_XOPEN_SOURCE -D_DARWIN_C_SOURCE +} + +_C_DEFINES_WITH_VALGRIND= +when ($WITH_VALGRIND == "yes") { + _C_DEFINES_WITH_VALGRIND=-DWITH_VALGRIND=1 +} + +C_DEFINES =-DFAKEID=$CPP_FAKEID +C_DEFINES+=$_C_DEFINES_ANDROID +C_DEFINES+=\ +-DARCADIA_ROOT=${ARCADIA_ROOT} \ +-DARCADIA_BUILD_ROOT=${ARCADIA_BUILD_ROOT} \ +-D_THREAD_SAFE \ +-D_PTHREADS \ +-D_REENTRANT \ +-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES \ +-D_LARGEFILE_SOURCE \ +-D__STDC_CONSTANT_MACROS \ +-D__STDC_FORMAT_MACROS +C_DEFINES+=$_C_DEFINES_ANDROID_OTHERWISE +C_DEFINES+=$_C_DEFINES_GNU_SOURCE +C_DEFINES+=$_C_DEFINES_CLANG_LINUX_X86_64 +C_DEFINES+=$_C_DEFINES_IOS +C_DEFINES+=$_C_DEFINES_WITH_VALGRIND +C_DEFINES+=$_C_DEFINES_NDEBUG + +_C_FOPTIONS_INIT_ARRAY= +when ($CLANG == "yes" && $OS_LINUX == "yes") { + # Use .init_array instead of .ctors (default for old clang versions) + # See: https://maskray.me/blog/2021-11-07-init-ctors-init-array + _C_FOPTIONS_INIT_ARRAY=-fuse-init-array +} + +_C_FOPTIONS_COLOR= +_C_FOPTIONS_ALIGNED_ALLOCATION= +when ($CLANG == "yes") { + # Set up output colorization + _C_FOPTIONS_COLOR=-fcolor-diagnostics + # Enable aligned allocation + _C_FOPTIONS_ALIGNED_ALLOCATION=-faligned-allocation +} +elsewhen ($GCC == "yes") { + # Set up output colorization + _C_FOPTIONS_COLOR=-fdiagnostics-color=always + # It looks like there is no way to enable aligned allocation in gcc +} + +_C_FOPTIONS_MAPSMOBI_ARM= +when ($OS_IOS == "yes") { + when ($MAPSMOBI_BUILD_TARGET == "yes" && $ARCH_ARM == "yes") { + _C_FOPTIONS_MAPSMOBI_ARM=-fembed-bitcode + } +} + +_C_WARNINGS_CLANG= +_CXX_WARNINGS_CLANG= +when ($CLANG == "yes") { + + _CXX_WARNINGS_CLANG=\ +-Wimport-preprocessor-directive-pedantic \ +-Wno-undefined-var-template \ +-Wno-return-std-move \ +-Wno-address-of-packed-member \ +-Wno-defaulted-function-deleted \ +-Wno-pessimizing-move \ +-Wno-range-loop-construct \ +-Wno-deprecated-anon-enum-enum-conversion \ +-Wno-deprecated-enum-enum-conversion \ +-Wno-deprecated-enum-float-conversion \ +-Wno-ambiguous-reversed-operator \ +-Wno-deprecated-volatile + +# -Wno-unknown-warning-option +# For nvcc to accept the above. + _C_WARNINGS_CLANG=\ +-Wno-implicit-const-int-float-conversion \ +-Wno-unknown-warning-option + +} + +_C_FOPTIONS_GCC= +when ($GCC == "yes") { + _C_FOPTIONS_GCC=-fno-delete-null-pointer-checks -fabi-version=8 +} + +_C_FOPTIONS_IOS= +when ($OS_IOS != "yes") { + # Split all functions and data into separate sections for DCE and ICF linker passes + # NOTE: iOS build uses -fembed-bitcode which conflicts with -ffunction-sections (only relevant for ELF targets) + _C_FOPTIONS_IOS=-ffunction-sections -fdata-sections +} + +_C_FOPTIONS_DEBUG= +when ($_BUILD_DEBUG == "yes") { + _C_FOPTIONS_DEBUG=$FSTACK +} + +_C_FLAGS_RELEASE= +_C_FOPTIONS_RELEASE= +_OPTIMIZE_RELEASE= +when ($_BUILD_RELEASE == "yes") { + _C_FLAGS_RELEASE=$OPTIMIZE + when ($_BUILD_SIZE_OPTIMIZED == "yes") { + # -Oz is clang's more size-aggressive version of -Os + # For ARM specifically, clang -Oz is on par with gcc -Os: + # https://github.com/android/ndk/issues/133#issuecomment-365763507 + when($CLANG == "yes") { + _OPTIMIZE_RELEASE=-Oz + } + otherwise { + _OPTIMIZE_RELEASE=-Os + } + + # Generate sections with address significance tables for ICF linker pass + when($CLANG == "yes") { + _C_FOPTIONS_RELEASE=-faddrsig + } + } + otherwise { + _OPTIMIZE_RELEASE=-O3 + } +} + +_C_FOPTIONS_PROFILER= +when ($_BUILD_PROFILER_TYPE != "") { + when ($_BUILD_PROFILER_TYPE in ["generic", "gprof"]) { + _C_FOPTIONS_PROFILER=-fno-omit-frame-pointer + } +} + +_C_FOPTIONS = + +# Enable C++ exceptions (and allow them to be throw through pure C code) +_C_FOPTIONS+=-fexceptions + +# Enable standard-conforming behavior and generate duplicate symbol error in case of duplicated global constants. +# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678#c0 +_C_FOPTIONS+=-fno-common + +_C_FOPTIONS+=$_C_FOPTIONS_INIT_ARRAY +_C_FOPTIONS+=$_C_FOPTIONS_COLOR +_C_FOPTIONS+=$_C_FOPTIONS_ALIGNED_ALLOCATION +_C_FOPTIONS+=$_C_FOPTIONS_MAPSMOBI_ARM +_C_FOPTIONS+=$_C_FOPTIONS_DEBUG +_C_FOPTIONS+=$_C_FOPTIONS_RELEASE +_C_FOPTIONS+=$_C_FOPTIONS_PROFILER +_C_FOPTIONS+=$_C_FOPTIONS_GCC +_C_FOPTIONS+=$_C_FOPTIONS_IOS + +# Enable default warnings subset +_C_WARNINGS =-Wall -Wextra + +# Disable some warnings which will fail compilation at the time +_C_WARNINGS+=-Wno-parentheses + +_C_WARNINGS+=$_C_WARNINGS_CLANG + +# Issue a warning if certain overload is hidden due to inheritance +_CXX_WARNINGS =-Woverloaded-virtual + +_CXX_WARNINGS+=$_CXX_WARNINGS_CLANG + +_C_FLAGS_ARCH= +when ($ARCH_I386 == "yes") { + _C_FLAGS_ARCH=-m32 +} +when ($ARCH_X86_64 == "yes") { + _C_FLAGS_ARCH=-m64 +} + +_C_FLAGS_FAST_DEBUG= +when ($_BUILD_FAST_DEBUG == "yes") { + _C_FLAGS_FAST_DEBUG=-Og +} + +_C_DEFINES_NDEBUG=-UNDEBUG +when ($_BUILD_WITH_NDEBUG == "yes") { + _C_DEFINES_NDEBUG=-DNDEBUG +} + +_C_FLAGS_PROFILER= +when ($_BUILD_PROFILER_TYPE == "gprof") { + _C_FLAGS_PROFILER=-pg +} + +_C_FLAGS=\ +$CL_DEBUG_INFO $CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__ $_C_FLAGS_ARCH_OPT -pipe +_C_FLAGS+=$_C_FLAGS_ARCH +_C_FLAGS+=$_C_FLAGS_FAST_DEBUG +_C_FLAGS+=$_C_FLAGS_RELEASE +_C_FLAGS+=$_C_FLAGS_PROFILER + +_SFDL_FLAGS=-E -C -x c++ +when ($CLANG == "yes") { + _SFDL_FLAGS+=-Qunused-arguments +} + +_DEBUG_INFO_FLAGS=-g +when ($OS_LINUX == "yes") { + _DEBUG_INFO_FLAGS=-g -ggnu-pubnames +} + +_CROSS_SUFFIX=.pic +when ($FORCE_NO_PIC == "yes") { + _CROSS_SUFFIX= +} + +C_COMPILER=${quo:C_COMPILER_UNQUOTED} +OPTIMIZE=$_OPTIMIZE_RELEASE +FSTACK=-fstack-protector +DUMP_DEPS= +GCC_PREPROCESSOR_OPTS=$DUMP_DEPS $C_DEFINES +C_WARNING_OPTS=$_C_WARNINGS +CXX_WARNING_OPTS=$_CXX_WARNINGS + +# PIE is only valid for executables, while PIC implies a shared library +# `-pie` with a shared library is either ignored or fails to link +when ($PIC == "yes") { + CFLAGS+=-fPIC + LDFLAGS+=-fPIC +} +elsewhen ($PIE == "yes") { + CFLAGS+=-fPIE + LDFLAGS+=-fPIE -pie +} + +CFLAGS+=$_C_FLAGS $DEBUG_INFO_FLAGS $_C_FOPTIONS $C_WARNING_OPTS $GCC_PREPROCESSOR_OPTS $USER_CFLAGS $USER_CFLAGS_GLOBAL +CXXFLAGS+=$CFLAGS $_CXX_STD $CXX_WARNING_OPTS $USER_CXXFLAGS $USER_CXXFLAGS_GLOBAL +CONLYFLAGS+=$USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL +CXX_COMPILER=${quo:CXX_COMPILER_UNQUOTED} +NOGCCSTACKCHECK=yes +SFDL_FLAG=$_SFDL_FLAGS -o $SFDL_TMP_OUT +WERROR_FLAG=-Werror +DEBUG_INFO_FLAGS=$_DEBUG_INFO_FLAGS + +when ($NO_WSHADOW == "yes") { + C_WARNING_OPTS += -Wno-shadow +} +when ($NO_COMPILER_WARNINGS == "yes") { + C_WARNING_OPTS = -w + CXX_WARNING_OPTS = -Wno-everything +} +when ($NO_OPTIMIZE == "yes") { + OPTIMIZE = -O0 +} +when ($SAVE_TEMPS == "yes") { + CXXFLAGS += -save-temps +} +when ($NOGCCSTACKCHECK != "yes") { + FSTACK += -fstack-check +} + +# _C_DEBUG_LIGHT=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B +# _C_DEBUG_LIGHT_CL=$_C_DEBUG_LIGHT -Xclang -fdebug-compilation-dir -Xclang /tmp +# _C_DEBUG=$_C_DEBUG_LIGHT -fdebug-prefix-map=${ARCADIA_ROOT}=/-S -fdebug-prefix-map=$(TOOL_ROOT)=/-T +# _C_DEBUG_CL=$_C_DEBUG -Xclang -fdebug-compilation-dir -Xclang /tmp +# _YASM_DEBUG_LIGHT=--replace=${ARCADIA_BUILD_ROOT}=/-B +# _YASM_DEBUG=$_YASM_DEBUG_LIGHT --replace=${ARCADIA_ROOT}=/-S --replace=$(TOOL_ROOT)=/-T +# when ($FORCE_CONSISTENT_DEBUG == "yes") { +# when ($CLANG == "yes") { +# CL_DEBUG_INFO=$_C_DEBUG_CL +# } +# otherwise { +# CL_DEBUG_INFO=$_C_DEBUG +# } +# YASM_DEBUG_INFO=$_YASM_DEBUG +# } +# elsewhen ($CONSISTENT_DEBUG == "yes") { +# when ($CLANG == "yes") { +# CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=$_C_DEBUG_CL +# } +# otherwise { +# CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=$_C_DEBUG +# } +# YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=$_YASM_DEBUG +# } +# elsewhen ($CONSISTENT_DEBUG_LIGHT == "yes") { +# when ($CLANG == "yes") { +# CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=$_C_DEBUG_LIGHT_CL +# } +# otherwise { +# CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=$_C_DEBUG_LIGHT +# } +# YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=$_YASM_DEBUG_LIGHT +# } +# +# _C_BUILTINS=-Wno-builtin-macro-redefined -D__DATE__="\"""Sep 31 2019""\"" -D__TIME__=\"00:00:00\" +# when ($CLANG == "yes" && $_TC_VERSION_AT_LEAST_10 || $GCC == "yes" && $_TC_VERSION_AT_LEAST_8 == "yes") { +# # XXX does not support non-normalized paths +# _C_BUILTINS+=-fmacro-prefix-map=${ARCADIA_BUILD_ROOT}/= -fmacro-prefix-map=${ARCADIA_ROOT}/= -fmacro-prefix-map=$(TOOL_ROOT)/= +# } +# otherwise { +# # XXX this macro substitution breaks __FILE__ in included sources +# _C_BUILTINS+=-D__FILE__=\"${input;qe;rootrel:SRC}\" +# } +# +# when ($FORCE_CONSISTENT_BUILD == "yes") { +# CL_MACRO_INFO=$_C_BUILTINS +# } +# elsewhen ($CONSISTENT_BUILD == "yes") { +# CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=$_C_BUILTINS +# } + +when ($FORCE_CONSISTENT_DEBUG == "yes") { + when ($CLANG == "yes") { + CL_DEBUG_INFO=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B -fdebug-prefix-map=${ARCADIA_ROOT}=/-S -fdebug-prefix-map=$(TOOL_ROOT)=/-T -Xclang -fdebug-compilation-dir -Xclang /tmp + } + otherwise { + CL_DEBUG_INFO=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B -fdebug-prefix-map=${ARCADIA_ROOT}=/-S -fdebug-prefix-map=$(TOOL_ROOT)=/-T + } + YASM_DEBUG_INFO=--replace=${ARCADIA_BUILD_ROOT}=/-B --replace=${ARCADIA_ROOT}=/-S --replace=$(TOOL_ROOT)=/-T +} +elsewhen ($CONSISTENT_DEBUG == "yes") { + when ($CLANG == "yes") { + CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B -fdebug-prefix-map=${ARCADIA_ROOT}=/-S -fdebug-prefix-map=$(TOOL_ROOT)=/-T -Xclang -fdebug-compilation-dir -Xclang /tmp + } + otherwise { + CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B -fdebug-prefix-map=${ARCADIA_ROOT}=/-S -fdebug-prefix-map=$(TOOL_ROOT)=/-T + } + YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=--replace=${ARCADIA_BUILD_ROOT}=/-B --replace=${ARCADIA_ROOT}=/-S --replace=$(TOOL_ROOT)=/-T +} +elsewhen ($CONSISTENT_DEBUG_LIGHT == "yes") { + when ($CLANG == "yes") { + CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B -Xclang -fdebug-compilation-dir -Xclang /tmp + } + otherwise { + CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=-fdebug-prefix-map=${ARCADIA_BUILD_ROOT}=/-B + } + YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=--replace=${ARCADIA_BUILD_ROOT}=/-B +} + +when ($FORCE_CONSISTENT_BUILD == "yes") { + CL_MACRO_INFO=-Wno-builtin-macro-redefined -D__DATE__=\""Sep 31 2019\"" -D__TIME__=\"00:00:00\" -fmacro-prefix-map=${ARCADIA_BUILD_ROOT}/= -fmacro-prefix-map=${ARCADIA_ROOT}/= -fmacro-prefix-map=$(TOOL_ROOT)/= +} +elsewhen ($CONSISTENT_BUILD == "yes") { + CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=-Wno-builtin-macro-redefined -D__DATE__=\""Sep 31 2019\"" -D__TIME__=\"00:00:00\" -fmacro-prefix-map=${ARCADIA_BUILD_ROOT}/= -fmacro-prefix-map=${ARCADIA_ROOT}/= -fmacro-prefix-map=$(TOOL_ROOT)/= +} + +_CFLAGS_ARCH_I386= +when ($ARCH_I386 == "yes" && $ARCH_I686 != "yes") { + _CFLAGS_ARCH_I386=-march=pentiumpro -mtune=pentiumpro +} + +CFLAGS+=$_CFLAGS_ARCH_I386 + +BC_CFLAGS+=$CFLAGS +BC_CXXFLAGS+=$CXXFLAGS +C_DEFINES+=-D__LONG_LONG_SUPPORTED + +OBJ_CROSS_SUF=$OBJ_SUF$_CROSS_SUFFIX +OBJECT_SUF=$OBJ_SUF$_CROSS_SUFFIX.o +GCC_COMPILE_FLAGS=$EXTRA_C_FLAGS -c -o $_COMPILE_OUTPUTS ${pre=-I:_C__INCLUDE} +EXTRA_COVERAGE_OUTPUT=${output;noauto;hide;suf=${OBJECT_SUF}.gcno:SRC} +CLANG_TIDY_OUTPUT_FILE=${output;noauto;suf=${OBJECT_SUF}.tidyjson:SRC} +YNDEXER_OUTPUT_FILE=${output;noauto;suf=${OBJECT_SUF}.ydx.pb2:SRC} + +when ($DUMP_COMPILER_DEPS == "yes") { + DUMP_DEPS=-MD ${output;hide;noauto;suf=${OBJ_SUF}.o.d:SRC} +} +elsewhen ($DUMP_COMPILER_DEPS_FAST == "yes") { + DUMP_DEPS=-E -M -MF ${output;noauto;suf=${OBJ_SUF}.o.d:SRC} +} + +_COMPILER_TIME_TRACE_GRANULARITY=500 +when ($TIME_TRACE_GRANULARITY && $TIME_TRACE_GRANULARITY != "") { + _COMPILER_TIME_TRACE_GRANULARITY=$TIME_TRACE_GRANULARITY +} + +_COMPILER_TIME_TRACE_FLAGS= +_COMPILER_TIME_TRACE_POSTPROCESS= +when (($TIME_TRACE == "yes" || $COMPILER_TIME_TRACE == "yes") && $CLANG == "yes" && $_TC_VERSION_AT_LEAST_9 == "yes") { + _COMPILER_TIME_TRACE_FLAGS=-ftime-trace -ftime-trace-granularity=$_COMPILER_TIME_TRACE_GRANULARITY + _COMPILER_TIME_TRACE_POSTPROCESS=$YMAKE_PYTHON ${input:"build/scripts/find_time_trace.py"} $_COMPILE_OUTPUTS $_COMPILE_TIME_TRACE_OUTPUTS +} + +_C_CPP_KV_STYLE=${requirements;hide:CC_REQUIREMENTS} ${hide;kv:"p CC"} ${hide;kv:"pc green"} +_CPP_ARGS=\ +$CLANG_TIDY_ARGS \ +$YNDEXER_ARGS \ +$CXX_COMPILER \ +$C_FLAGS_PLATFORM \ +$GCC_COMPILE_FLAGS \ +$CXXFLAGS \ +$CL_MACRO_INFO \ +$CL_MACRO_INFO_DISABLE_CACHE__NO_UID__ \ +$_COMPILER_TIME_TRACE_FLAGS \ +$EXTRA_OUTPUT \ +$SRCFLAGS \ +$_LANG_CFLAGS_VALUE \ +${input:SRC} \ +$TOOLCHAIN_ENV \ +$YNDEXER_OUTPUT \ +&& $_COMPILER_TIME_TRACE_POSTPROCESS \ +$_C_CPP_KV_STYLE + +_C_ARGS=\ +$CLANG_TIDY_ARGS \ +$YNDEXER_ARGS \ +$C_COMPILER \ +$C_FLAGS_PLATFORM \ +$GCC_COMPILE_FLAGS \ +$CFLAGS \ +$CL_MACRO_INFO \ +$CL_MACRO_INFO_DISABLE_CACHE__NO_UID__ \ +$_COMPILER_TIME_TRACE_FLAGS \ +$CONLYFLAGS \ +$EXTRA_OUTPUT \ +$SRCFLAGS \ +${input:SRC} \ +$TOOLCHAIN_ENV \ +$YNDEXER_OUTPUT \ +$_C_CPP_KV_STYLE + +### _SRC_C_NODEPS_CMD is obtained from _C_ARGS by filtering the following elements: +### ${input:SRC} +### $CL_MACRO_INFO +### $CL_MACRO_INFO_DISABLE_CACHE__NO_UID__ +### $CLANG_TIDY_ARGS +### $EXTRA_OUTPUT +### $EXTRA_COVERAGE_OUTPUT +### $SRCFLAGS +### $YNDEXER_ARGS +### $YNDEXER_OUTPUT +### +### $GCC_COMPILE_FLAGS is substituted for $EXTRA_C_FLAGS -c -o ${OUTFILE} ${SRC} ${pre=-I:INC} +_SRC_C_NODEPS_CMD=\ +$C_COMPILER \ +$C_FLAGS_PLATFORM \ +$EXTRA_C_FLAGS -c -o ${OUTFILE} ${SRC} ${pre=-I:INC} \ +$CFLAGS \ +$CONLYFLAGS \ +$TOOLCHAIN_ENV \ +$_C_CPP_KV_STYLE + +_SRC_CPP_CMD=$_CPP_ARGS +_SRC_C_CMD=$_C_ARGS +_SRC_M_CMD=$SRC_c($SRC $SRCFLAGS) +_SRC_MASM_CMD=$_EMPTY_CMD + +# fuzzing configuration +when ($CLANG == "yes") { + when ($_TC_VERSION_AT_LEAST_12 == "yes") { + LIBFUZZER_PATH=contrib/libs/libfuzzer12 + } +} diff --git a/build/conf/compilers/msvc_compiler.conf b/build/conf/compilers/msvc_compiler.conf index 6667f35c5c..d09d51d8bd 100644 --- a/build/conf/compilers/msvc_compiler.conf +++ b/build/conf/compilers/msvc_compiler.conf @@ -1,294 +1,294 @@ -_MSVC_MACRO=_WIN32_WINNT -_MSVC_WINDOWS7=0x0601 -_MSVC_WINDOWS8=0x0602 - -_MSVC_WARNS_ENABLED= -# 'expression' : signed/unsigned mismatch -_MSVC_WARNS_ENABLED+=/w14018 -# 'class' : class has virtual functions, but destructor is not virtual -_MSVC_WARNS_ENABLED+=/w14265 -# 'operator' : expression is always false -_MSVC_WARNS_ENABLED+=/w14296 -# missing type specifier - int assumed -_MSVC_WARNS_ENABLED+=/w14431 - -_MSVC_WARNS_AS_ERRORS= -# 'function' undefined; assuming extern returning int -_MSVC_WARNS_AS_ERRORS+=/we4013 - -_MSVC_WARNS_DISABLED= -# conditional expression is constant -_MSVC_WARNS_DISABLED+=/wd4127 -# nonstandard extension used : zero-sized array in struct/union -_MSVC_WARNS_DISABLED+=/wd4200 -# nonstandard extension used : nameless struct/union -_MSVC_WARNS_DISABLED+=/wd4201 -# elements of array will be default initialized -_MSVC_WARNS_DISABLED+=/wd4351 -# 'this' : used in base member initializer list -_MSVC_WARNS_DISABLED+=/wd4355 -# decorated name length exceeded, name was truncated -_MSVC_WARNS_DISABLED+=/wd4503 -# default constructor could not be generated -_MSVC_WARNS_DISABLED+=/wd4510 -# copy constructor could not be generated -_MSVC_WARNS_DISABLED+=/wd4511 -# assignment operator could not be generated -_MSVC_WARNS_DISABLED+=/wd4512 -# check operator precedence for possible error; use parentheses to clarify precedence -_MSVC_WARNS_DISABLED+=/wd4554 -# 'object' can never be instantiated - user defined constructor required -_MSVC_WARNS_DISABLED+=/wd4610 -# assignment within conditional expression -_MSVC_WARNS_DISABLED+=/wd4706 -# forcing value to bool 'true' or 'false' (performance warning) -_MSVC_WARNS_DISABLED+=/wd4800 -# The POSIX name for this item is deprecated -_MSVC_WARNS_DISABLED+=/wd4996 -# function marked as __forceinline not inlined -_MSVC_WARNS_DISABLED+=/wd4714 -# 'TAtomic' : top-level volatile in cast is ignored -_MSVC_WARNS_DISABLED+=/wd4197 -# 'initializing' : conversion from 'int' to 'ui32', signed/unsigned mismatch -_MSVC_WARNS_DISABLED+=/wd4245 -# 'ystd::function<void (uint8_t *)>': structure was padded due to alignment specifier -_MSVC_WARNS_DISABLED+=/wd4324 -# 'register' is no longer a supported storage class -_MSVC_WARNS_DISABLED+=/wd5033 - -_C_WARNINGS_CLANG_CL= -_CXX_WARNINGS_CLANG_CL= -_CXX_WARNINGS_CLANG_CL_2019= -_CXX_WARNINGS_CLANG_CL_2019_IDE_MSVS= -when ($CLANG_CL == "yes") { - _C_WARNINGS_CLANG_CL=\ --Wno-absolute-value \ --Wno-bitwise-op-parentheses \ --Wno-dll-attribute-on-redeclaration \ --Wno-extern-initializer \ --Wno-format \ --Wno-ignored-pragma-optimize \ --Wno-inconsistent-dllimport \ --Wno-int-conversion \ --Wno-int-to-void-pointer-cast \ --Wno-invalid-noreturn \ --Wno-logical-op-parentheses \ --Wno-macro-redefined \ --Wno-parentheses \ --Wno-pragma-pack \ --Wno-tautological-constant-out-of-range-compare \ --Wno-unknown-argument \ --Wno-unknown-warning-option - - _CXX_WARNINGS_CLANG_CL=\ --Woverloaded-virtual \ --Wno-attributes - # IGNIETFERRO-722 needed for contrib - _CXX_WARNINGS_CLANG_CL+=-Wno-register - - _CXX_WARNINGS_CLANG_CL+=\ --Wimport-preprocessor-directive-pedantic \ --Wno-undefined-var-template - - when ($_TC_VERSION_AT_LEAST_2019 == "yes") { - _CXX_WARNINGS_CLANG_CL_2019=\ --Wno-deprecated-volatile \ --Wno-deprecated-anon-enum-enum-conversion \ --Wno-defaulted-function-deleted \ --Wno-deprecated-enum-enum-conversion \ --Wno-ambiguous-reversed-operator \ --Wno-deprecated-enum-float-conversion \ --Wno-pointer-to-int-cast - } - - when ($IDE_MSVS == "yes") { - _CXX_WARNINGS_CLANG_CL_2019_IDE_MSVS=-Wno-unused-command-line-argument - } -} - -_C_WARNINGS =$_MSVC_WARNS_AS_ERRORS -_C_WARNINGS+=$_MSVC_WARNS_ENABLED -_C_WARNINGS+=$_MSVC_WARNS_DISABLED -_C_WARNINGS+=$_C_WARNINGS_CLANG_CL - -_CXX_WARNINGS = -_CXX_WARNINGS+=$_CXX_WARNINGS_CLANG_CL -_CXX_WARNINGS+=$_CXX_WARNINGS_CLANG_CL_2019 -_CXX_WARNINGS+=$_CXX_WARNINGS_CLANG_CL_2019_IDE_MSVS - -_WINAPI_UNICODE=no - -_DEFINES_ARCH= -when ($ARCH_X86_64 == "yes") { - _DEFINES_ARCH=/D_WIN64 /DWIN64 -} -elsewhen ($ARCH_ARMV7 == "yes") { - _DEFINES_ARCH=/D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE /D__arm__ -} - -_DEFINES_WIN32_WINNT=/D$_MSVC_MACRO=$_MSVC_WINDOWS7 - -when ($_WINAPI_UNICODE == "yes") { - _DEFINES_UNICODE=/DUNICODE /D_UNICODE -} -otherwise { - _DEFINES_UNICODE=/D_MBCS -} - -_C_DEFINES=\ -/DARCADIA_ROOT=${ARCADIA_ROOT} \ -/DARCADIA_BUILD_ROOT=${ARCADIA_BUILD_ROOT} \ -/DFAKEID=$CPP_FAKEID \ -/DWIN32 \ -/D_WIN32 \ -/D_WINDOWS \ -/D_CRT_SECURE_NO_WARNINGS \ -/D_CRT_NONSTDC_NO_WARNINGS \ -/D_USE_MATH_DEFINES \ -/D__STDC_CONSTANT_MACROS \ -/D__STDC_FORMAT_MACROS \ -/D_USING_V110_SDK71_ \ -/D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES \ -/DNOMINMAX \ -/DWIN32_LEAN_AND_MEAN - -_C_DEFINES+=$_DEFINES_ARCH -_C_DEFINES+=$_DEFINES_WIN32_WINNT -_C_DEFINES+=$_DEFINES_UNICODE - -C_DEFINES+=$_C_DEFINES - -_MSVC_FLAGS_CLANG= -_MSVC_FLAGS_CLANG_NO_WARNINGS= -_MSVC_FLAGS_CLANG_ARCH= -_MSVC_FLAGS_CLANG_EQ_2019= -when ($CLANG_CL == "yes") { - # -fcase-insensitive-paths - # Allow <windows.h> to be included via <Windows.h> in case-sensitive file-systems. - # - # -fno-common - # Enable standard-conforming behavior and generate duplicate symbol error in case of duplicated global constants. - # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678#c0 - _MSVC_FLAGS_CLANG=-fcase-insensitive-paths -fno-common - when ($ARCH_X86_64 == "yes") { - _MSVC_FLAGS_CLANG_ARCH=-m64 - } - elsewhen ($ARCH_I386 == "yes") { - _MSVC_FLAGS_CLANG_ARCH=-m32 - } - otherwise { - _MSVC_FLAGS_CLANG_ARCH= - } - - # Some warnings are getting triggered even when NO_COMPILER_WARNINGS is enabled - _MSVC_FLAGS_CLANG_NO_WARNINGS=-Wno-c++11-narrowing -Wno-register - - when ($_TC_VERSION_EXACTLY_2019 == "yes") { - # heretic: на момент коммита в нашей конфигурации указано, что тулчейн clang11-windows - аналог msvc 2019 - # https://a.yandex-team.ru/arc/trunk/arcadia/build/ya.conf.json?rev=r7910792#L2185 - # сам clang11 по дефолту представляется msvc2017 (#define _MSC_VER 1911 - # https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/clang11/lib/Driver/ToolChains/MSVC.cpp?rev=r7913127#L1352 - # вручную заставляем его представляться msvc2019 (#define _MSC_VER 1921) - # значение версии взято вот отсюда: - # https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/llvm11/include/llvm/Support/Compiler.h?blame=true&rev=r7913127#L89 - _MSVC_FLAGS_CLANG_EQ_2019=-fms-compatibility-version=19.21 - } -} - -_MSVC_FLAGS=/nologo /Zm500 /GR /bigobj /FC /EHs /errorReport:prompt $MSVC_INLINE_FLAG /utf-8 -# enable standard conforming mode -_MSVC_FLAGS+=/permissive- -_MSVC_FLAGS+=$_MSVC_FLAGS_ARCH_OPT -_MSVC_FLAGS+=$_MSVC_FLAGS_CLANG -_MSVC_FLAGS+=$_MSVC_FLAGS_CLANG_ARCH -_MSVC_FLAGS+=$_MSVC_FLAGS_CLANG_NO_WARNINGS -_MSVC_FLAGS+=$_MSVC_FLAGS_CLANG_EQ_2019 -_MSVC_FLAGS+=$_MSVC_FLAGS_INCLUDE - -MSVC_INLINE_OPTIMIZED=yes -when ($MSVC_INLINE_OPTIMIZED == "yes") { - MSVC_INLINE_FLAG=/Zc:inline -} -when ($MSVC_INLINE_OPTIMIZED == "no") { - MSVC_INLINE_FLAG=/Zc:inline- -} - -# Use builtin offsetof implementation -# instead of a crutcy macro defined in ucrt/stddef.h. -# The latter can not be used in constexpr statements. -_CXX_DEFINES=/D_CRT_USE_BUILTIN_OFFSETOF - -_FLAGS_C_ONLY= - -# Provide proper __cplusplus value -# https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ -_CXX_FLAGS=/Zc:__cplusplus - -_FLAGS_MSVS_ONLY= -DEBUG_INFO_FLAGS=/Z7 -when ($IDE_MSVS == "yes") { - when ($CLANG_CL != "yes") { - _FLAGS_MSVS_ONLY=/FD /MP - } - DEBUG_INFO_FLAGS=/Zi /FS -} - -C_WARNING_OPTS=$_C_WARNINGS -CXX_WARNING_OPTS=$_CXX_WARNINGS - -# https://msdn.microsoft.com/en-us/library/abx4dbyh.aspx -when ($DLL_RUNTIME == "yes") { - _FLAGS_DEBUG_RUNTIME=/MDd - _FLAGS_RELEASE_RUNTIME=/MD -} -otherwise { - _FLAGS_DEBUG_RUNTIME=/MTd - _FLAGS_RELEASE_RUNTIME=/MT -} -CFLAGS_DEBUG=/Ob0 /Od /D_DEBUG $_FLAGS_DEBUG_RUNTIME -CFLAGS_RELEASE=/Ox /Ob2 /Oi /DNDEBUG $_FLAGS_RELEASE_RUNTIME - -MASMFLAGS= -_MASM_IO=/nologo /c /Fo${output;suf=${OBJECT_SUF}:SRC} ${input;msvs_source:SRC} -when ($ARCH_ARMV7) { - _MASM_IO=-o ${output;suf=${OBJECT_SUF}:SRC} ${input;msvs_source:SRC} -} - -OBJ_CROSS_SUF=$OBJ_SUF -OBJECT_SUF=$OBJ_SUF.obj - -CFLAGS+=$_MSVC_FLAGS $_FLAGS_MSVS_ONLY $CFLAGS_PER_TYPE $DEBUG_INFO_FLAGS $C_WARNING_OPTS $C_DEFINES $USER_CFLAGS $USER_CFLAGS_GLOBAL -CXXFLAGS+=$CFLAGS $_STD_CXX $_CXX_FLAGS $_CXX_DEFINES $CXX_WARNING_OPTS $USER_CXXFLAGS $USER_CXXFLAGS_GLOBAL -CONLYFLAGS+=$_FLAGS_C_ONLY $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL - -BC_CFLAGS+=$CFLAGS -BC_CXXFLAGS+=$BC_CFLAGS $CXXFLAGS - -CFLAGS+=$_CFLAGS_UCRT_VC_INCLUDES - -when ($NO_WSHADOW == "yes") { - C_WARNING_OPTS+=/wd4456 /wd4457 -} -when ($NO_COMPILER_WARNINGS == "yes") { - C_WARNING_OPTS=/w - CXX_WARNING_OPTS= -} -when ($NO_OPTIMIZE == "yes") { - OPTIMIZE=/Od -} - -SFDL_FLAG=/E /C /P /TP /Fi$SFDL_TMP_OUT -WERROR_FLAG=/WX - -CL_WRAPPER=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} cl -ML_WRAPPER=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} ml -when ($_UNDER_WINE == "yes") { - CL_WRAPPER= - ML_WRAPPER= -} - -_SRC_C_NODEPS_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo${OUTFILE} ${SRC} ${EXTRA_C_FLAGS} ${pre=/I :INC} ${CFLAGS} ${requirements;hide:CC_REQUIREMENTS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"} -_SRC_CPP_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${CXX_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${input;msvs_source:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CXXFLAGS} ${SRCFLAGS} ${_LANG_CFLAGS_VALUE} ${requirements;hide:CC_REQUIREMENTS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"} -_SRC_C_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${input;msvs_source:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CFLAGS} ${CONLYFLAGS} ${SRCFLAGS} ${requirements;hide:CC_REQUIREMENTS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"} -_SRC_M_CMD=$_EMPTY_CMD -_SRC_MASM_CMD=${cwd:ARCADIA_BUILD_ROOT} ${TOOLCHAIN_ENV} ${ML_WRAPPER} ${MASM_COMPILER} ${MASMFLAGS} ${SRCFLAGS} $_MASM_IO ${requirements;hide:CC_REQUIREMENTS} ${kv;hide:"p AS"} ${kv;hide:"pc yellow"} +_MSVC_MACRO=_WIN32_WINNT +_MSVC_WINDOWS7=0x0601 +_MSVC_WINDOWS8=0x0602 + +_MSVC_WARNS_ENABLED= +# 'expression' : signed/unsigned mismatch +_MSVC_WARNS_ENABLED+=/w14018 +# 'class' : class has virtual functions, but destructor is not virtual +_MSVC_WARNS_ENABLED+=/w14265 +# 'operator' : expression is always false +_MSVC_WARNS_ENABLED+=/w14296 +# missing type specifier - int assumed +_MSVC_WARNS_ENABLED+=/w14431 + +_MSVC_WARNS_AS_ERRORS= +# 'function' undefined; assuming extern returning int +_MSVC_WARNS_AS_ERRORS+=/we4013 + +_MSVC_WARNS_DISABLED= +# conditional expression is constant +_MSVC_WARNS_DISABLED+=/wd4127 +# nonstandard extension used : zero-sized array in struct/union +_MSVC_WARNS_DISABLED+=/wd4200 +# nonstandard extension used : nameless struct/union +_MSVC_WARNS_DISABLED+=/wd4201 +# elements of array will be default initialized +_MSVC_WARNS_DISABLED+=/wd4351 +# 'this' : used in base member initializer list +_MSVC_WARNS_DISABLED+=/wd4355 +# decorated name length exceeded, name was truncated +_MSVC_WARNS_DISABLED+=/wd4503 +# default constructor could not be generated +_MSVC_WARNS_DISABLED+=/wd4510 +# copy constructor could not be generated +_MSVC_WARNS_DISABLED+=/wd4511 +# assignment operator could not be generated +_MSVC_WARNS_DISABLED+=/wd4512 +# check operator precedence for possible error; use parentheses to clarify precedence +_MSVC_WARNS_DISABLED+=/wd4554 +# 'object' can never be instantiated - user defined constructor required +_MSVC_WARNS_DISABLED+=/wd4610 +# assignment within conditional expression +_MSVC_WARNS_DISABLED+=/wd4706 +# forcing value to bool 'true' or 'false' (performance warning) +_MSVC_WARNS_DISABLED+=/wd4800 +# The POSIX name for this item is deprecated +_MSVC_WARNS_DISABLED+=/wd4996 +# function marked as __forceinline not inlined +_MSVC_WARNS_DISABLED+=/wd4714 +# 'TAtomic' : top-level volatile in cast is ignored +_MSVC_WARNS_DISABLED+=/wd4197 +# 'initializing' : conversion from 'int' to 'ui32', signed/unsigned mismatch +_MSVC_WARNS_DISABLED+=/wd4245 +# 'ystd::function<void (uint8_t *)>': structure was padded due to alignment specifier +_MSVC_WARNS_DISABLED+=/wd4324 +# 'register' is no longer a supported storage class +_MSVC_WARNS_DISABLED+=/wd5033 + +_C_WARNINGS_CLANG_CL= +_CXX_WARNINGS_CLANG_CL= +_CXX_WARNINGS_CLANG_CL_2019= +_CXX_WARNINGS_CLANG_CL_2019_IDE_MSVS= +when ($CLANG_CL == "yes") { + _C_WARNINGS_CLANG_CL=\ +-Wno-absolute-value \ +-Wno-bitwise-op-parentheses \ +-Wno-dll-attribute-on-redeclaration \ +-Wno-extern-initializer \ +-Wno-format \ +-Wno-ignored-pragma-optimize \ +-Wno-inconsistent-dllimport \ +-Wno-int-conversion \ +-Wno-int-to-void-pointer-cast \ +-Wno-invalid-noreturn \ +-Wno-logical-op-parentheses \ +-Wno-macro-redefined \ +-Wno-parentheses \ +-Wno-pragma-pack \ +-Wno-tautological-constant-out-of-range-compare \ +-Wno-unknown-argument \ +-Wno-unknown-warning-option + + _CXX_WARNINGS_CLANG_CL=\ +-Woverloaded-virtual \ +-Wno-attributes + # IGNIETFERRO-722 needed for contrib + _CXX_WARNINGS_CLANG_CL+=-Wno-register + + _CXX_WARNINGS_CLANG_CL+=\ +-Wimport-preprocessor-directive-pedantic \ +-Wno-undefined-var-template + + when ($_TC_VERSION_AT_LEAST_2019 == "yes") { + _CXX_WARNINGS_CLANG_CL_2019=\ +-Wno-deprecated-volatile \ +-Wno-deprecated-anon-enum-enum-conversion \ +-Wno-defaulted-function-deleted \ +-Wno-deprecated-enum-enum-conversion \ +-Wno-ambiguous-reversed-operator \ +-Wno-deprecated-enum-float-conversion \ +-Wno-pointer-to-int-cast + } + + when ($IDE_MSVS == "yes") { + _CXX_WARNINGS_CLANG_CL_2019_IDE_MSVS=-Wno-unused-command-line-argument + } +} + +_C_WARNINGS =$_MSVC_WARNS_AS_ERRORS +_C_WARNINGS+=$_MSVC_WARNS_ENABLED +_C_WARNINGS+=$_MSVC_WARNS_DISABLED +_C_WARNINGS+=$_C_WARNINGS_CLANG_CL + +_CXX_WARNINGS = +_CXX_WARNINGS+=$_CXX_WARNINGS_CLANG_CL +_CXX_WARNINGS+=$_CXX_WARNINGS_CLANG_CL_2019 +_CXX_WARNINGS+=$_CXX_WARNINGS_CLANG_CL_2019_IDE_MSVS + +_WINAPI_UNICODE=no + +_DEFINES_ARCH= +when ($ARCH_X86_64 == "yes") { + _DEFINES_ARCH=/D_WIN64 /DWIN64 +} +elsewhen ($ARCH_ARMV7 == "yes") { + _DEFINES_ARCH=/D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE /D__arm__ +} + +_DEFINES_WIN32_WINNT=/D$_MSVC_MACRO=$_MSVC_WINDOWS7 + +when ($_WINAPI_UNICODE == "yes") { + _DEFINES_UNICODE=/DUNICODE /D_UNICODE +} +otherwise { + _DEFINES_UNICODE=/D_MBCS +} + +_C_DEFINES=\ +/DARCADIA_ROOT=${ARCADIA_ROOT} \ +/DARCADIA_BUILD_ROOT=${ARCADIA_BUILD_ROOT} \ +/DFAKEID=$CPP_FAKEID \ +/DWIN32 \ +/D_WIN32 \ +/D_WINDOWS \ +/D_CRT_SECURE_NO_WARNINGS \ +/D_CRT_NONSTDC_NO_WARNINGS \ +/D_USE_MATH_DEFINES \ +/D__STDC_CONSTANT_MACROS \ +/D__STDC_FORMAT_MACROS \ +/D_USING_V110_SDK71_ \ +/D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES \ +/DNOMINMAX \ +/DWIN32_LEAN_AND_MEAN + +_C_DEFINES+=$_DEFINES_ARCH +_C_DEFINES+=$_DEFINES_WIN32_WINNT +_C_DEFINES+=$_DEFINES_UNICODE + +C_DEFINES+=$_C_DEFINES + +_MSVC_FLAGS_CLANG= +_MSVC_FLAGS_CLANG_NO_WARNINGS= +_MSVC_FLAGS_CLANG_ARCH= +_MSVC_FLAGS_CLANG_EQ_2019= +when ($CLANG_CL == "yes") { + # -fcase-insensitive-paths + # Allow <windows.h> to be included via <Windows.h> in case-sensitive file-systems. + # + # -fno-common + # Enable standard-conforming behavior and generate duplicate symbol error in case of duplicated global constants. + # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678#c0 + _MSVC_FLAGS_CLANG=-fcase-insensitive-paths -fno-common + when ($ARCH_X86_64 == "yes") { + _MSVC_FLAGS_CLANG_ARCH=-m64 + } + elsewhen ($ARCH_I386 == "yes") { + _MSVC_FLAGS_CLANG_ARCH=-m32 + } + otherwise { + _MSVC_FLAGS_CLANG_ARCH= + } + + # Some warnings are getting triggered even when NO_COMPILER_WARNINGS is enabled + _MSVC_FLAGS_CLANG_NO_WARNINGS=-Wno-c++11-narrowing -Wno-register + + when ($_TC_VERSION_EXACTLY_2019 == "yes") { + # heretic: на момент коммита в нашей конфигурации указано, что тулчейн clang11-windows - аналог msvc 2019 + # https://a.yandex-team.ru/arc/trunk/arcadia/build/ya.conf.json?rev=r7910792#L2185 + # сам clang11 по дефолту представляется msvc2017 (#define _MSC_VER 1911 + # https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/clang11/lib/Driver/ToolChains/MSVC.cpp?rev=r7913127#L1352 + # вручную заставляем его представляться msvc2019 (#define _MSC_VER 1921) + # значение версии взято вот отсюда: + # https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/llvm11/include/llvm/Support/Compiler.h?blame=true&rev=r7913127#L89 + _MSVC_FLAGS_CLANG_EQ_2019=-fms-compatibility-version=19.21 + } +} + +_MSVC_FLAGS=/nologo /Zm500 /GR /bigobj /FC /EHs /errorReport:prompt $MSVC_INLINE_FLAG /utf-8 +# enable standard conforming mode +_MSVC_FLAGS+=/permissive- +_MSVC_FLAGS+=$_MSVC_FLAGS_ARCH_OPT +_MSVC_FLAGS+=$_MSVC_FLAGS_CLANG +_MSVC_FLAGS+=$_MSVC_FLAGS_CLANG_ARCH +_MSVC_FLAGS+=$_MSVC_FLAGS_CLANG_NO_WARNINGS +_MSVC_FLAGS+=$_MSVC_FLAGS_CLANG_EQ_2019 +_MSVC_FLAGS+=$_MSVC_FLAGS_INCLUDE + +MSVC_INLINE_OPTIMIZED=yes +when ($MSVC_INLINE_OPTIMIZED == "yes") { + MSVC_INLINE_FLAG=/Zc:inline +} +when ($MSVC_INLINE_OPTIMIZED == "no") { + MSVC_INLINE_FLAG=/Zc:inline- +} + +# Use builtin offsetof implementation +# instead of a crutcy macro defined in ucrt/stddef.h. +# The latter can not be used in constexpr statements. +_CXX_DEFINES=/D_CRT_USE_BUILTIN_OFFSETOF + +_FLAGS_C_ONLY= + +# Provide proper __cplusplus value +# https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ +_CXX_FLAGS=/Zc:__cplusplus + +_FLAGS_MSVS_ONLY= +DEBUG_INFO_FLAGS=/Z7 +when ($IDE_MSVS == "yes") { + when ($CLANG_CL != "yes") { + _FLAGS_MSVS_ONLY=/FD /MP + } + DEBUG_INFO_FLAGS=/Zi /FS +} + +C_WARNING_OPTS=$_C_WARNINGS +CXX_WARNING_OPTS=$_CXX_WARNINGS + +# https://msdn.microsoft.com/en-us/library/abx4dbyh.aspx +when ($DLL_RUNTIME == "yes") { + _FLAGS_DEBUG_RUNTIME=/MDd + _FLAGS_RELEASE_RUNTIME=/MD +} +otherwise { + _FLAGS_DEBUG_RUNTIME=/MTd + _FLAGS_RELEASE_RUNTIME=/MT +} +CFLAGS_DEBUG=/Ob0 /Od /D_DEBUG $_FLAGS_DEBUG_RUNTIME +CFLAGS_RELEASE=/Ox /Ob2 /Oi /DNDEBUG $_FLAGS_RELEASE_RUNTIME + +MASMFLAGS= +_MASM_IO=/nologo /c /Fo${output;suf=${OBJECT_SUF}:SRC} ${input;msvs_source:SRC} +when ($ARCH_ARMV7) { + _MASM_IO=-o ${output;suf=${OBJECT_SUF}:SRC} ${input;msvs_source:SRC} +} + +OBJ_CROSS_SUF=$OBJ_SUF +OBJECT_SUF=$OBJ_SUF.obj + +CFLAGS+=$_MSVC_FLAGS $_FLAGS_MSVS_ONLY $CFLAGS_PER_TYPE $DEBUG_INFO_FLAGS $C_WARNING_OPTS $C_DEFINES $USER_CFLAGS $USER_CFLAGS_GLOBAL +CXXFLAGS+=$CFLAGS $_STD_CXX $_CXX_FLAGS $_CXX_DEFINES $CXX_WARNING_OPTS $USER_CXXFLAGS $USER_CXXFLAGS_GLOBAL +CONLYFLAGS+=$_FLAGS_C_ONLY $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL + +BC_CFLAGS+=$CFLAGS +BC_CXXFLAGS+=$BC_CFLAGS $CXXFLAGS + +CFLAGS+=$_CFLAGS_UCRT_VC_INCLUDES + +when ($NO_WSHADOW == "yes") { + C_WARNING_OPTS+=/wd4456 /wd4457 +} +when ($NO_COMPILER_WARNINGS == "yes") { + C_WARNING_OPTS=/w + CXX_WARNING_OPTS= +} +when ($NO_OPTIMIZE == "yes") { + OPTIMIZE=/Od +} + +SFDL_FLAG=/E /C /P /TP /Fi$SFDL_TMP_OUT +WERROR_FLAG=/WX + +CL_WRAPPER=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} cl +ML_WRAPPER=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} ml +when ($_UNDER_WINE == "yes") { + CL_WRAPPER= + ML_WRAPPER= +} + +_SRC_C_NODEPS_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo${OUTFILE} ${SRC} ${EXTRA_C_FLAGS} ${pre=/I :INC} ${CFLAGS} ${requirements;hide:CC_REQUIREMENTS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"} +_SRC_CPP_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${CXX_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${input;msvs_source:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CXXFLAGS} ${SRCFLAGS} ${_LANG_CFLAGS_VALUE} ${requirements;hide:CC_REQUIREMENTS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"} +_SRC_C_CMD=${TOOLCHAIN_ENV} ${CL_WRAPPER} ${C_COMPILER} /c /Fo$_COMPILE_OUTPUTS ${input;msvs_source:SRC} ${EXTRA_C_FLAGS} ${pre=/I :_C__INCLUDE} ${CFLAGS} ${CONLYFLAGS} ${SRCFLAGS} ${requirements;hide:CC_REQUIREMENTS} ${hide;kv:"soe"} ${hide;kv:"p CC"} ${hide;kv:"pc yellow"} +_SRC_M_CMD=$_EMPTY_CMD +_SRC_MASM_CMD=${cwd:ARCADIA_BUILD_ROOT} ${TOOLCHAIN_ENV} ${ML_WRAPPER} ${MASM_COMPILER} ${MASMFLAGS} ${SRCFLAGS} $_MASM_IO ${requirements;hide:CC_REQUIREMENTS} ${kv;hide:"p AS"} ${kv;hide:"pc yellow"} diff --git a/build/conf/java.ymake.conf b/build/conf/java.ymake.conf index ed85153c78..78b9522daf 100644 --- a/build/conf/java.ymake.conf +++ b/build/conf/java.ymake.conf @@ -152,7 +152,7 @@ multimodule JAVA_CONTRIB_PROGRAM { } module _DLL_COMPATIBLE_JAVA_LIBRARY: EXTERNAL_JAVA_LIBRARY { - SET(DONT_RESOLVE_INCLUDES yes) + SET(DONT_RESOLVE_INCLUDES yes) } ### @usage: DLL_JAVA() diff --git a/build/conf/linkers/ld.conf b/build/conf/linkers/ld.conf index 655c09dc66..16a73122e4 100644 --- a/build/conf/linkers/ld.conf +++ b/build/conf/linkers/ld.conf @@ -1,383 +1,383 @@ -_LD_FLAGS_1= -_LD_FLAGS_2= -when ($MUSL == "yes") { - _LD_FLAGS_1=-Wl,--no-as-needed - when ($GCC == "yes") { - # MUSL_BFD: musl build uses --no-dynamic-linker linker flag - # which gold doesn't know about. And we can only specify linker - # type, not it's path as we do for Clang through linker selector. - _LD_FLAGS_2=-fuse-ld=bfd - } -} -elsewhen ($OS_LINUX == "yes") { - _LD_FLAGS_1=-ldl -lrt -Wl,--no-as-needed - when ($GCC == "yes") { - _LD_FLAGS_2=-Wl,-Bstatic -latomic -Wl,-Bdynamic - } -} -elsewhen ($OS_ANDROID == "yes") { - _LD_FLAGS_1=-ldl -Wl,--no-as-needed - when ($_DEFAULT_LINKER_ID == "lld" && $_ANDROID_API_LESS_THEN_29 == "yes") { - # https://github.com/android/ndk/issues/1196 - _LD_FLAGS_2=-Wl,--no-rosegment - } -} -elsewhen ($OS_DARWIN == "yes") { - _LD_FLAGS_1=-Wl,-no_deduplicate - when ($CLANG != "yes") { - _LD_FLAGS_2=-Wl,-no_compact_unwind - } -} - -_LD_FLAGS_IOS_MAPSMOBI_ARM= -when ($OS_IOS == "yes" && $MAPSMOBI_BUILD_TARGET == "yes" && $ARCH_ARM) { - _LD_FLAGS_IOS_MAPSMOBI_ARM=-fembed-bitcode -Wl,-bitcode_verify -} - -_LD_FLAGS_PROFILER_TYPE= -when ($_BUILD_PROFILER_TYPE == "gprof") { - _LD_FLAGS_PROFILER_TYPE=-pg -} - -_LD_FLAGS_COVERAGE= -when ($_BUILD_COVERAGE == "yes") { - _LD_FLAGS_COVERAGE=-fprofile-arcs -ftest-coverage -} - -_LD_FLAGS = -_LD_FLAGS+=$_LD_FLAGS_1 -_LD_FLAGS+=$_LD_FLAGS_2 -_LD_FLAGS+=$_LD_FLAGS_IOS_MAPSMOBI_ARM -_LD_FLAGS+=$_LD_FLAGS_PROFILER_TYPE -_LD_FLAGS+=$_LD_FLAGS_COVERAGE -_LD_FLAGS+=$LD_SDK_VERSION - -LDFLAGS+=$USER_LDFLAGS $_LD_FLAGS -LDFLAGS_GLOBAL+= - -_START_GROUP= -_END_GROUP= -START_WHOLE_ARCHIVE_VALUE= -END_WHOLE_ARCHIVE_VALUE= -LD_STRIP_FLAG= -_SONAME_OPTION= -_LD_SRCS_GLOBALS=--start-wa ${rootrel;ext=.a:SRCS_GLOBAL} --end-wa ${rootrel;ext=.o:SRCS_GLOBAL} ${rootrel;ext=.supp:SRCS_GLOBAL} -when ($OS_LINUX == "yes" || $OS_ANDROID == "yes" || $OS_CYGWIN == "yes" || $OS_NONE == "yes") { - _START_GROUP=-Wl,--start-group - _END_GROUP=-Wl,--end-group - START_WHOLE_ARCHIVE_VALUE=-Wl,--whole-archive - END_WHOLE_ARCHIVE_VALUE=-Wl,--no-whole-archive - LD_STRIP_FLAG=-s - _SONAME_OPTION=-soname - _LD_SRCS_GLOBALS=-Wl,--whole-archive ${rootrel;ext=.a:SRCS_GLOBAL} -Wl,--no-whole-archive ${rootrel;ext=.o:SRCS_GLOBAL} ${rootrel;ext=.supp:SRCS_GLOBAL} -} - -when ($_LD_WHOLE_ARCHIVE == "yes") { -} - -when ($OS_DARWIN == "yes" || $OS_IOS == "yes") { - _SONAME_OPTION=-install_name -} - -_LD_LINKER_OUTPUT= -_LD_LINKER_OUTPUT_FLAG=--linker-output ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION.linker.txt:REALPRJNAME} - -# Enable section-level DCE (dead code elimination): -# remove whole unused code and data sections -# (needs `-ffunction-sections` and `-fdata-sections` to be useful) -# -# NOTE: CGO linker doesn't seem to support DCE, but shares common LDFLAGS -_LD_DCE_FLAG_GC_SECTIONS= -_LD_DCE_FLAG_PRINT_SECTIONS= -when ($OS_DARWIN == "yes") { - _LD_DCE_FLAG_GC_SECTIONS=-Wl,-dead_strip -} -elsewhen ($OS_LINUX == "yes" || $OS_ANDROID == "yes") { - _LD_DCE_FLAG_GC_SECTIONS=-Wl,--gc-sections - when ($LINKER_DCE_PRINT_SECTIONS == "yes") { - _LD_DCE_FLAG_PRINT_SECTIONS=-Wl,--print-gc-sections - _LD_LINKER_OUTPUT=$_LD_LINKER_OUTPUT_FLAG - } -} -LD_DCE_FLAG = -LD_DCE_FLAG+=$_LD_DCE_FLAG_GC_SECTIONS -LD_DCE_FLAG+=$_LD_DCE_FLAG_PRINT_SECTIONS -DCE_FLAG= - -_LD_ICF_FLAG= -_LD_ICF_FLAG_PRINT_SECTIONS= -when ($_DEFAULT_LINKER_ID == "lld") { - # Enable ICF (identical code folding pass) in safe mode - # https://research.google/pubs/pub36912/ - _LD_ICF_FLAG=-Wl,-icf=safe - when ($LINKER_ICF_PRINT_SECTIONS == "yes") { - _LD_ICF_FLAG_PRINT_SECTIONS=-Wl,--print-icf-sections - _LD_LINKER_OUTPUT=$_LD_LINKER_OUTPUT_FLAG - } -} -LD_ICF_FLAG = -LD_ICF_FLAG+=$_LD_ICF_FLAG -LD_ICF_FLAG+=$_LD_ICF_FLAG_PRINT_SECTIONS -ICF_FLAG= - -STRIP_FLAG= - -C_LIBRARY_PATH= -C_SYSTEM_LIBRARIES_INTERCEPT= - -_LD_THREAD_LIBRARY= -when ($OS_LINUX == "yes" || $OS_DARWIN == "yes") { - _LD_THREAD_LIBRARY=-lpthread -} - -_LD_USE_STDLIB= -when ($_BUILD_COVERAGE == "yes" || $GCOV_COVERAGE == "yes" || $CLANG_COVERAGE == "yes" || $_BUILD_SANITIZED == "yes") { - _LD_USE_STDLIB= -} -elsewhen ($OS_ANDROID == "yes") { - when ($_ANDROID_NDK_VERSION_LESS_THEN_23 == "yes") { - # Preserve old behaviour: specify runtime libs manually - _LD_USE_STDLIB=-nodefaultlibs - } - otherwise { - # Use toolchain defaults to link with libunwind/clang_rt.builtins - _LD_USE_STDLIB=-nostdlib++ - } -} -elsewhen ($OS_LINUX == "yes" || $OS_DARWIN == "yes" || $OS_IOS == "yes") { - _LD_USE_STDLIB=-nodefaultlibs -} - -_C_SYSTEM_LIBRARIES=$_LD_USE_STDLIB $_LD_THREAD_LIBRARY $_LD_SYS_LIB -lc -when ($MUSL == "yes") { - _C_SYSTEM_LIBRARIES=-nostdlib -} -C_SYSTEM_LIBRARIES=$_C_SYSTEM_LIBRARIES - -OBJADDE= - -LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG= -when ($OS_LINUX == "yes" || $OS_ANDROID == "yes") { - LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG=-rdynamic -} - -NO_EXPORT_DYNAMIC_SYMBOLS= -EXPORTS_VALUE=$LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG -when ($EXPORTS_FILE) { - EXPORTS_VALUE=$LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG -Wl,--version-script=${input:EXPORTS_FILE} -} -when ($NO_EXPORT_DYNAMIC_SYMBOLS == "yes") { - EXPORTS_VALUE= -} - -LINKER_SCRIPT_VALUE=${ext=.ld;pre=-T:SRCS_GLOBAL} - -_LINKER_TIME_TRACE_GRANULARITY=500 -when ($TIME_TRACE_GRANULARITY && $TIME_TRACE_GRANULARITY != "") { - _LINKER_TIME_TRACE_GRANULARITY=$TIME_TRACE_GRANULARITY -} - -_LINKER_TIME_TRACE_FLAG= -when (($TIME_TRACE == "yes" || $LINKER_TIME_TRACE == "yes") && $_DEFAULT_LINKER_ID == "lld") { - _LINKER_TIME_TRACE_FLAG=\ --Wl,--time-trace \ --Wl,--time-trace-granularity=$_LINKER_TIME_TRACE_GRANULARITY \ --Wl,--time-trace-file=${output;rootrel;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.time_trace.json:REALPRJNAME} -} - -_EXE_FLAGS=\ -$C_FLAGS_PLATFORM \ -$BEFORE_PEERS \ -$_START_GROUP \ -${rootrel:PEERS} \ -$_END_GROUP \ -$AFTER_PEERS \ -$EXPORTS_VALUE \ -$LINKER_SCRIPT_VALUE \ -$LDFLAGS \ -$LDFLAGS_GLOBAL \ -$OBJADDE \ -$OBJADDE_LIB \ -$C_LIBRARY_PATH \ -$C_SYSTEM_LIBRARIES_INTERCEPT \ -$C_SYSTEM_LIBRARIES \ -$STRIP_FLAG \ -$DCE_FLAG \ -$ICF_FLAG \ -$_LINKER_TIME_TRACE_FLAG - -_SONAME_FLAG=-Wl,$_SONAME_OPTION,$_SONAME -_SHARED_FLAG=-shared -_EXEC_SHARED_FLAG= -when ($OS_LINUX == "yes") { - _EXEC_SHARED_FLAG=-pie -fPIE -Wl,--unresolved-symbols=ignore-all -rdynamic -} - -_LD_ENV_STYLE=${cwd:ARCADIA_BUILD_ROOT} $TOOLCHAIN_ENV ${kv;hide:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} - -# Program -GENERATE_MF_CMD=\ -$YMAKE_PYTHON ${input:"build/scripts/generate_mf.py"} \ ---build-root $ARCADIA_BUILD_ROOT \ ---module-name $REALPRJNAME \ --o ${output;rootrel;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.mf:REALPRJNAME} \ --t $MODULE_TYPE \ ---ya-start-command-file \ --Ya,lics $LICENSE_NAMES \ --Ya,peers ${rootrel:PEERS} \ --Ya,credits ${input:CREDITS_TEXTS_FILE} $CREDITS_FLAGS \ ---ya-end-command-file - -LINK_SCRIPT_EXE_FLAGS= - -REAL_LINK_EXE_CMDLINE =\ -$YMAKE_PYTHON ${input:"build/scripts/link_exe.py"} \ ---source-root $ARCADIA_ROOT -REAL_LINK_EXE_CMDLINE+=$_LD_LINKER_OUTPUT -REAL_LINK_EXE_CMDLINE+=\ -${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ -${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ -$_LD_ARCH_FLAG \ -$LINK_SCRIPT_EXE_FLAGS \ -$CXX_COMPILER \ -$_LD_SRCS_GLOBALS \ -$VCS_C_OBJ $AUTO_INPUT -o $TARGET \ -$_EXE_FLAGS \ -$_LD_ENV_STYLE - -REAL_LINK_EXE_TIDY=\ -$YMAKE_PYTHON ${input:"build/scripts/clang_tidy_arch.py"} \ ---build-root $ARCADIA_BUILD_ROOT \ ---source-root $ARCADIA_ROOT \ ---output-file $TARGET \ -$AUTO_INPUT \ -$_LD_ENV_STYLE - -# Executable Shared Library - -REAL_LINK_EXEC_DYN_LIB_CMDLINE =\ -$YMAKE_PYTHON ${input:"build/scripts/link_dyn_lib.py"} \ ---target $TARGET -REAL_LINK_EXEC_DYN_LIB_CMDLINE+=$_LD_LINKER_OUTPUT -REAL_LINK_EXEC_DYN_LIB_CMDLINE+=\ -${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ -${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ -$_LD_ARCH_FLAG \ -$LINK_DYN_LIB_FLAGS \ -$CXX_COMPILER \ -$_LD_SRCS_GLOBALS \ -$VCS_C_OBJ $AUTO_INPUT -o $TARGET \ -$_EXEC_SHARED_FLAG \ -$_SONAME_FLAG \ -$_EXE_FLAGS \ -$_LD_ENV_STYLE - -REAL_LINK_EXEC_DYN_LIB=$REAL_LINK_EXEC_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) - -# Shared Library - -LINK_DYN_LIB_FLAGS= - -REAL_LINK_DYN_LIB_CMDLINE =\ -$YMAKE_PYTHON ${input:"build/scripts/link_dyn_lib.py"} \ ---target $TARGET -REAL_LINK_DYN_LIB_CMDLINE+=$_LD_LINKER_OUTPUT -REAL_LINK_DYN_LIB_CMDLINE+=\ -${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ -${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ -$_LD_ARCH_FLAG \ -$LINK_DYN_LIB_FLAGS \ -$CXX_COMPILER \ -$_LD_SRCS_GLOBALS \ -$VCS_C_OBJ $AUTO_INPUT -o $TARGET \ -$_SHARED_FLAG \ -$_SONAME_FLAG \ -$_EXE_FLAGS \ -$_LD_ENV_STYLE - -REAL_LINK_DYN_LIB=$REAL_LINK_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) - -_DWARF_COMMAND= -when ($OS_DARWIN == "yes" && $NO_DEBUGINFO != "yes") { - _DWARF_COMMAND=$DWARF_TOOL $TARGET -o ${output;pre=$MODULE_PREFIX$REALPRJNAME.dSYM/Contents/Resources/DWARF/$MODULE_PREFIX:REALPRJNAME} $_LD_ENV_STYLE -} -DWARF_COMMAND=$_DWARF_COMMAND - -_REAL_LINK_EXE=$REAL_LINK_EXE_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) -_LINK_EXE=$GENERATE_MF && $GENERATE_VCS_C_INFO_NODEP && $REAL_LINK_EXE && $DWARF_COMMAND && $LINK_ADDITIONAL_SECTIONS_COMMAND && $PACK_IOS_CMD -_LINK_DYN_LIB=$GENERATE_MF && $GENERATE_VCS_C_INFO_NODEP && $REAL_LINK_DYN_LIB && $DWARF_COMMAND && $LINK_ADDITIONAL_SECTIONS_COMMAND -when ($TIDY == "yes") { - _REAL_LINK_EXE=$REAL_LINK_EXE_TIDY - _LINK_EXE=$REAL_LINK_EXE - _LINK_DYN_LIB=$REAL_LINK_EXE -} -REAL_LINK_EXE=$_REAL_LINK_EXE -LINK_EXE=$_LINK_EXE -LINK_DYN_LIB=$_LINK_DYN_LIB - -LINK_EXEC_DYN_LIB=\ -$GENERATE_MF && \ -$GENERATE_VCS_C_INFO_NODEP && \ -$REAL_LINK_EXEC_DYN_LIB && \ -$DWARF_COMMAND && \ -$LINK_ADDITIONAL_SECTIONS_COMMAND - -SWIG_DLL_JAR_CMD=\ -$GENERATE_MF && \ -$GENERATE_VCS_C_INFO_NODEP && \ -$REAL_SWIG_DLL_JAR_CMD && \ -$DWARF_COMMAND - -_LD_TAIL_LINK_LIB=$AUTO_INPUT ${requirements;hide:LIB_REQUIREMENTS} ${kv;hide:"p AR"} $TOOLCHAIN_ENV ${kv;hide:"pc light-red"} ${kv;hide:"show_out"} -_LD_ARCHIVER=$YMAKE_PYTHON ${input:"build/scripts/link_lib.py"} ${quo:AR_TOOL} $AR_TYPE $_LD_LLVM_AR_FORMAT $ARCADIA_BUILD_ROOT $_LD_AR_PLUGIN -_LD_LIB_GENERATE_MF=$GENERATE_MF && -when ($TIDY == "yes") { - _LD_ARCHIVER=$YMAKE_PYTHON ${input:"build/scripts/clang_tidy_arch.py"} --source-root $ARCADIA_ROOT --build-root $ARCADIA_BUILD_ROOT --output-file - _LD_LIB_GENERATE_MF= -} -LINK_LIB=$_LD_LIB_GENERATE_MF $_LD_ARCHIVER $TARGET $_LD_TAIL_LINK_LIB -GLOBAL_LINK_LIB=$_LD_ARCHIVER $GLOBAL_TARGET $_LD_TAIL_LINK_LIB - -# "Fat Object" : pre-linked global objects and static library with all dependencies -_LD_LINK_FAT_PREFIX=$GENERATE_MF && $GENERATE_VCS_C_INFO_NODEP && $YMAKE_PYTHON ${input:"build/scripts/link_fat_obj.py"} --build-root $ARCADIA_BUILD_ROOT -_LD_LINK_FAT_SRCS_GLOBALS_WA=$_LD_SRCS_GLOBALS -_LD_LINK_FAT_SRCS_GLOBALS_NO_WA=${rootrel;ext=.a:SRCS_GLOBAL} ${rootrel;ext=.o:SRCS_GLOBAL} - -_LD_LINK_FAT_SUFFIX1=$_LD_ARCH_FLAG \ --Ya,input $AUTO_INPUT $VCS_C_OBJ \ --Ya,global_srcs - -_LD_LINK_FAT_SUFFIX2=-Ya,peers $PEERS \ --Ya,linker $CXX_COMPILER \ -$LDFLAGS_GLOBAL $C_FLAGS_PLATFORM $LD_SDK_VERSION \ --Ya,archiver $_LD_ARCHIVER \ -$TOOLCHAIN_ENV ${kv;hide:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} - -LINK_FAT_OBJECT=\ -$_LD_LINK_FAT_PREFIX \ ---obj=$TARGET --lib=${output:REALPRJNAME.a} \ -$_LD_LINK_FAT_SUFFIX1 \ -$_LD_LINK_FAT_SRCS_GLOBALS_WA \ -$_LD_LINK_FAT_SUFFIX2 - -LINK_RECURSIVE_LIBRARY=\ -$_LD_LINK_FAT_PREFIX \ ---lib=$TARGET --with-own-obj --with-global-srcs \ -$_LD_LINK_FAT_SUFFIX1 \ -$_LD_LINK_FAT_SRCS_GLOBALS_NO_WA \ -$_LD_LINK_FAT_SUFFIX2 - -LINK_FAT_OBJECT_LIBRARY=\ -$_LD_LINK_FAT_PREFIX \ ---lib=$TARGET $FAT_OBJECT_ARGS $FAT_OBJECT_OUTS \ -$_LD_LINK_FAT_SUFFIX1 \ -$_LD_LINK_FAT_SRCS_GLOBALS_NO_WA \ -$_LD_LINK_FAT_SUFFIX2 - -LIBRT=-lrt -MD5LIB=-lcrypt -LIBRESOLV= -when ($OS_LINUX || $OS_DARWIN || $OS_ANDROID) { - LIBRESOLV=-lresolv -} -PROFFLAG=-pg +_LD_FLAGS_1= +_LD_FLAGS_2= +when ($MUSL == "yes") { + _LD_FLAGS_1=-Wl,--no-as-needed + when ($GCC == "yes") { + # MUSL_BFD: musl build uses --no-dynamic-linker linker flag + # which gold doesn't know about. And we can only specify linker + # type, not it's path as we do for Clang through linker selector. + _LD_FLAGS_2=-fuse-ld=bfd + } +} +elsewhen ($OS_LINUX == "yes") { + _LD_FLAGS_1=-ldl -lrt -Wl,--no-as-needed + when ($GCC == "yes") { + _LD_FLAGS_2=-Wl,-Bstatic -latomic -Wl,-Bdynamic + } +} +elsewhen ($OS_ANDROID == "yes") { + _LD_FLAGS_1=-ldl -Wl,--no-as-needed + when ($_DEFAULT_LINKER_ID == "lld" && $_ANDROID_API_LESS_THEN_29 == "yes") { + # https://github.com/android/ndk/issues/1196 + _LD_FLAGS_2=-Wl,--no-rosegment + } +} +elsewhen ($OS_DARWIN == "yes") { + _LD_FLAGS_1=-Wl,-no_deduplicate + when ($CLANG != "yes") { + _LD_FLAGS_2=-Wl,-no_compact_unwind + } +} + +_LD_FLAGS_IOS_MAPSMOBI_ARM= +when ($OS_IOS == "yes" && $MAPSMOBI_BUILD_TARGET == "yes" && $ARCH_ARM) { + _LD_FLAGS_IOS_MAPSMOBI_ARM=-fembed-bitcode -Wl,-bitcode_verify +} + +_LD_FLAGS_PROFILER_TYPE= +when ($_BUILD_PROFILER_TYPE == "gprof") { + _LD_FLAGS_PROFILER_TYPE=-pg +} + +_LD_FLAGS_COVERAGE= +when ($_BUILD_COVERAGE == "yes") { + _LD_FLAGS_COVERAGE=-fprofile-arcs -ftest-coverage +} + +_LD_FLAGS = +_LD_FLAGS+=$_LD_FLAGS_1 +_LD_FLAGS+=$_LD_FLAGS_2 +_LD_FLAGS+=$_LD_FLAGS_IOS_MAPSMOBI_ARM +_LD_FLAGS+=$_LD_FLAGS_PROFILER_TYPE +_LD_FLAGS+=$_LD_FLAGS_COVERAGE +_LD_FLAGS+=$LD_SDK_VERSION + +LDFLAGS+=$USER_LDFLAGS $_LD_FLAGS +LDFLAGS_GLOBAL+= + +_START_GROUP= +_END_GROUP= +START_WHOLE_ARCHIVE_VALUE= +END_WHOLE_ARCHIVE_VALUE= +LD_STRIP_FLAG= +_SONAME_OPTION= +_LD_SRCS_GLOBALS=--start-wa ${rootrel;ext=.a:SRCS_GLOBAL} --end-wa ${rootrel;ext=.o:SRCS_GLOBAL} ${rootrel;ext=.supp:SRCS_GLOBAL} +when ($OS_LINUX == "yes" || $OS_ANDROID == "yes" || $OS_CYGWIN == "yes" || $OS_NONE == "yes") { + _START_GROUP=-Wl,--start-group + _END_GROUP=-Wl,--end-group + START_WHOLE_ARCHIVE_VALUE=-Wl,--whole-archive + END_WHOLE_ARCHIVE_VALUE=-Wl,--no-whole-archive + LD_STRIP_FLAG=-s + _SONAME_OPTION=-soname + _LD_SRCS_GLOBALS=-Wl,--whole-archive ${rootrel;ext=.a:SRCS_GLOBAL} -Wl,--no-whole-archive ${rootrel;ext=.o:SRCS_GLOBAL} ${rootrel;ext=.supp:SRCS_GLOBAL} +} + +when ($_LD_WHOLE_ARCHIVE == "yes") { +} + +when ($OS_DARWIN == "yes" || $OS_IOS == "yes") { + _SONAME_OPTION=-install_name +} + +_LD_LINKER_OUTPUT= +_LD_LINKER_OUTPUT_FLAG=--linker-output ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION.linker.txt:REALPRJNAME} + +# Enable section-level DCE (dead code elimination): +# remove whole unused code and data sections +# (needs `-ffunction-sections` and `-fdata-sections` to be useful) +# +# NOTE: CGO linker doesn't seem to support DCE, but shares common LDFLAGS +_LD_DCE_FLAG_GC_SECTIONS= +_LD_DCE_FLAG_PRINT_SECTIONS= +when ($OS_DARWIN == "yes") { + _LD_DCE_FLAG_GC_SECTIONS=-Wl,-dead_strip +} +elsewhen ($OS_LINUX == "yes" || $OS_ANDROID == "yes") { + _LD_DCE_FLAG_GC_SECTIONS=-Wl,--gc-sections + when ($LINKER_DCE_PRINT_SECTIONS == "yes") { + _LD_DCE_FLAG_PRINT_SECTIONS=-Wl,--print-gc-sections + _LD_LINKER_OUTPUT=$_LD_LINKER_OUTPUT_FLAG + } +} +LD_DCE_FLAG = +LD_DCE_FLAG+=$_LD_DCE_FLAG_GC_SECTIONS +LD_DCE_FLAG+=$_LD_DCE_FLAG_PRINT_SECTIONS +DCE_FLAG= + +_LD_ICF_FLAG= +_LD_ICF_FLAG_PRINT_SECTIONS= +when ($_DEFAULT_LINKER_ID == "lld") { + # Enable ICF (identical code folding pass) in safe mode + # https://research.google/pubs/pub36912/ + _LD_ICF_FLAG=-Wl,-icf=safe + when ($LINKER_ICF_PRINT_SECTIONS == "yes") { + _LD_ICF_FLAG_PRINT_SECTIONS=-Wl,--print-icf-sections + _LD_LINKER_OUTPUT=$_LD_LINKER_OUTPUT_FLAG + } +} +LD_ICF_FLAG = +LD_ICF_FLAG+=$_LD_ICF_FLAG +LD_ICF_FLAG+=$_LD_ICF_FLAG_PRINT_SECTIONS +ICF_FLAG= + +STRIP_FLAG= + +C_LIBRARY_PATH= +C_SYSTEM_LIBRARIES_INTERCEPT= + +_LD_THREAD_LIBRARY= +when ($OS_LINUX == "yes" || $OS_DARWIN == "yes") { + _LD_THREAD_LIBRARY=-lpthread +} + +_LD_USE_STDLIB= +when ($_BUILD_COVERAGE == "yes" || $GCOV_COVERAGE == "yes" || $CLANG_COVERAGE == "yes" || $_BUILD_SANITIZED == "yes") { + _LD_USE_STDLIB= +} +elsewhen ($OS_ANDROID == "yes") { + when ($_ANDROID_NDK_VERSION_LESS_THEN_23 == "yes") { + # Preserve old behaviour: specify runtime libs manually + _LD_USE_STDLIB=-nodefaultlibs + } + otherwise { + # Use toolchain defaults to link with libunwind/clang_rt.builtins + _LD_USE_STDLIB=-nostdlib++ + } +} +elsewhen ($OS_LINUX == "yes" || $OS_DARWIN == "yes" || $OS_IOS == "yes") { + _LD_USE_STDLIB=-nodefaultlibs +} + +_C_SYSTEM_LIBRARIES=$_LD_USE_STDLIB $_LD_THREAD_LIBRARY $_LD_SYS_LIB -lc +when ($MUSL == "yes") { + _C_SYSTEM_LIBRARIES=-nostdlib +} +C_SYSTEM_LIBRARIES=$_C_SYSTEM_LIBRARIES + +OBJADDE= + +LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG= +when ($OS_LINUX == "yes" || $OS_ANDROID == "yes") { + LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG=-rdynamic +} + +NO_EXPORT_DYNAMIC_SYMBOLS= +EXPORTS_VALUE=$LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG +when ($EXPORTS_FILE) { + EXPORTS_VALUE=$LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG -Wl,--version-script=${input:EXPORTS_FILE} +} +when ($NO_EXPORT_DYNAMIC_SYMBOLS == "yes") { + EXPORTS_VALUE= +} + +LINKER_SCRIPT_VALUE=${ext=.ld;pre=-T:SRCS_GLOBAL} + +_LINKER_TIME_TRACE_GRANULARITY=500 +when ($TIME_TRACE_GRANULARITY && $TIME_TRACE_GRANULARITY != "") { + _LINKER_TIME_TRACE_GRANULARITY=$TIME_TRACE_GRANULARITY +} + +_LINKER_TIME_TRACE_FLAG= +when (($TIME_TRACE == "yes" || $LINKER_TIME_TRACE == "yes") && $_DEFAULT_LINKER_ID == "lld") { + _LINKER_TIME_TRACE_FLAG=\ +-Wl,--time-trace \ +-Wl,--time-trace-granularity=$_LINKER_TIME_TRACE_GRANULARITY \ +-Wl,--time-trace-file=${output;rootrel;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.time_trace.json:REALPRJNAME} +} + +_EXE_FLAGS=\ +$C_FLAGS_PLATFORM \ +$BEFORE_PEERS \ +$_START_GROUP \ +${rootrel:PEERS} \ +$_END_GROUP \ +$AFTER_PEERS \ +$EXPORTS_VALUE \ +$LINKER_SCRIPT_VALUE \ +$LDFLAGS \ +$LDFLAGS_GLOBAL \ +$OBJADDE \ +$OBJADDE_LIB \ +$C_LIBRARY_PATH \ +$C_SYSTEM_LIBRARIES_INTERCEPT \ +$C_SYSTEM_LIBRARIES \ +$STRIP_FLAG \ +$DCE_FLAG \ +$ICF_FLAG \ +$_LINKER_TIME_TRACE_FLAG + +_SONAME_FLAG=-Wl,$_SONAME_OPTION,$_SONAME +_SHARED_FLAG=-shared +_EXEC_SHARED_FLAG= +when ($OS_LINUX == "yes") { + _EXEC_SHARED_FLAG=-pie -fPIE -Wl,--unresolved-symbols=ignore-all -rdynamic +} + +_LD_ENV_STYLE=${cwd:ARCADIA_BUILD_ROOT} $TOOLCHAIN_ENV ${kv;hide:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} + +# Program +GENERATE_MF_CMD=\ +$YMAKE_PYTHON ${input:"build/scripts/generate_mf.py"} \ +--build-root $ARCADIA_BUILD_ROOT \ +--module-name $REALPRJNAME \ +-o ${output;rootrel;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.mf:REALPRJNAME} \ +-t $MODULE_TYPE \ +--ya-start-command-file \ +-Ya,lics $LICENSE_NAMES \ +-Ya,peers ${rootrel:PEERS} \ +-Ya,credits ${input:CREDITS_TEXTS_FILE} $CREDITS_FLAGS \ +--ya-end-command-file + +LINK_SCRIPT_EXE_FLAGS= + +REAL_LINK_EXE_CMDLINE =\ +$YMAKE_PYTHON ${input:"build/scripts/link_exe.py"} \ +--source-root $ARCADIA_ROOT +REAL_LINK_EXE_CMDLINE+=$_LD_LINKER_OUTPUT +REAL_LINK_EXE_CMDLINE+=\ +${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ +${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ +$_LD_ARCH_FLAG \ +$LINK_SCRIPT_EXE_FLAGS \ +$CXX_COMPILER \ +$_LD_SRCS_GLOBALS \ +$VCS_C_OBJ $AUTO_INPUT -o $TARGET \ +$_EXE_FLAGS \ +$_LD_ENV_STYLE + +REAL_LINK_EXE_TIDY=\ +$YMAKE_PYTHON ${input:"build/scripts/clang_tidy_arch.py"} \ +--build-root $ARCADIA_BUILD_ROOT \ +--source-root $ARCADIA_ROOT \ +--output-file $TARGET \ +$AUTO_INPUT \ +$_LD_ENV_STYLE + +# Executable Shared Library + +REAL_LINK_EXEC_DYN_LIB_CMDLINE =\ +$YMAKE_PYTHON ${input:"build/scripts/link_dyn_lib.py"} \ +--target $TARGET +REAL_LINK_EXEC_DYN_LIB_CMDLINE+=$_LD_LINKER_OUTPUT +REAL_LINK_EXEC_DYN_LIB_CMDLINE+=\ +${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ +${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ +$_LD_ARCH_FLAG \ +$LINK_DYN_LIB_FLAGS \ +$CXX_COMPILER \ +$_LD_SRCS_GLOBALS \ +$VCS_C_OBJ $AUTO_INPUT -o $TARGET \ +$_EXEC_SHARED_FLAG \ +$_SONAME_FLAG \ +$_EXE_FLAGS \ +$_LD_ENV_STYLE + +REAL_LINK_EXEC_DYN_LIB=$REAL_LINK_EXEC_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) + +# Shared Library + +LINK_DYN_LIB_FLAGS= + +REAL_LINK_DYN_LIB_CMDLINE =\ +$YMAKE_PYTHON ${input:"build/scripts/link_dyn_lib.py"} \ +--target $TARGET +REAL_LINK_DYN_LIB_CMDLINE+=$_LD_LINKER_OUTPUT +REAL_LINK_DYN_LIB_CMDLINE+=\ +${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ +${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ +$_LD_ARCH_FLAG \ +$LINK_DYN_LIB_FLAGS \ +$CXX_COMPILER \ +$_LD_SRCS_GLOBALS \ +$VCS_C_OBJ $AUTO_INPUT -o $TARGET \ +$_SHARED_FLAG \ +$_SONAME_FLAG \ +$_EXE_FLAGS \ +$_LD_ENV_STYLE + +REAL_LINK_DYN_LIB=$REAL_LINK_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) + +_DWARF_COMMAND= +when ($OS_DARWIN == "yes" && $NO_DEBUGINFO != "yes") { + _DWARF_COMMAND=$DWARF_TOOL $TARGET -o ${output;pre=$MODULE_PREFIX$REALPRJNAME.dSYM/Contents/Resources/DWARF/$MODULE_PREFIX:REALPRJNAME} $_LD_ENV_STYLE +} +DWARF_COMMAND=$_DWARF_COMMAND + +_REAL_LINK_EXE=$REAL_LINK_EXE_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) +_LINK_EXE=$GENERATE_MF && $GENERATE_VCS_C_INFO_NODEP && $REAL_LINK_EXE && $DWARF_COMMAND && $LINK_ADDITIONAL_SECTIONS_COMMAND && $PACK_IOS_CMD +_LINK_DYN_LIB=$GENERATE_MF && $GENERATE_VCS_C_INFO_NODEP && $REAL_LINK_DYN_LIB && $DWARF_COMMAND && $LINK_ADDITIONAL_SECTIONS_COMMAND +when ($TIDY == "yes") { + _REAL_LINK_EXE=$REAL_LINK_EXE_TIDY + _LINK_EXE=$REAL_LINK_EXE + _LINK_DYN_LIB=$REAL_LINK_EXE +} +REAL_LINK_EXE=$_REAL_LINK_EXE +LINK_EXE=$_LINK_EXE +LINK_DYN_LIB=$_LINK_DYN_LIB + +LINK_EXEC_DYN_LIB=\ +$GENERATE_MF && \ +$GENERATE_VCS_C_INFO_NODEP && \ +$REAL_LINK_EXEC_DYN_LIB && \ +$DWARF_COMMAND && \ +$LINK_ADDITIONAL_SECTIONS_COMMAND + +SWIG_DLL_JAR_CMD=\ +$GENERATE_MF && \ +$GENERATE_VCS_C_INFO_NODEP && \ +$REAL_SWIG_DLL_JAR_CMD && \ +$DWARF_COMMAND + +_LD_TAIL_LINK_LIB=$AUTO_INPUT ${requirements;hide:LIB_REQUIREMENTS} ${kv;hide:"p AR"} $TOOLCHAIN_ENV ${kv;hide:"pc light-red"} ${kv;hide:"show_out"} +_LD_ARCHIVER=$YMAKE_PYTHON ${input:"build/scripts/link_lib.py"} ${quo:AR_TOOL} $AR_TYPE $_LD_LLVM_AR_FORMAT $ARCADIA_BUILD_ROOT $_LD_AR_PLUGIN +_LD_LIB_GENERATE_MF=$GENERATE_MF && +when ($TIDY == "yes") { + _LD_ARCHIVER=$YMAKE_PYTHON ${input:"build/scripts/clang_tidy_arch.py"} --source-root $ARCADIA_ROOT --build-root $ARCADIA_BUILD_ROOT --output-file + _LD_LIB_GENERATE_MF= +} +LINK_LIB=$_LD_LIB_GENERATE_MF $_LD_ARCHIVER $TARGET $_LD_TAIL_LINK_LIB +GLOBAL_LINK_LIB=$_LD_ARCHIVER $GLOBAL_TARGET $_LD_TAIL_LINK_LIB + +# "Fat Object" : pre-linked global objects and static library with all dependencies +_LD_LINK_FAT_PREFIX=$GENERATE_MF && $GENERATE_VCS_C_INFO_NODEP && $YMAKE_PYTHON ${input:"build/scripts/link_fat_obj.py"} --build-root $ARCADIA_BUILD_ROOT +_LD_LINK_FAT_SRCS_GLOBALS_WA=$_LD_SRCS_GLOBALS +_LD_LINK_FAT_SRCS_GLOBALS_NO_WA=${rootrel;ext=.a:SRCS_GLOBAL} ${rootrel;ext=.o:SRCS_GLOBAL} + +_LD_LINK_FAT_SUFFIX1=$_LD_ARCH_FLAG \ +-Ya,input $AUTO_INPUT $VCS_C_OBJ \ +-Ya,global_srcs + +_LD_LINK_FAT_SUFFIX2=-Ya,peers $PEERS \ +-Ya,linker $CXX_COMPILER \ +$LDFLAGS_GLOBAL $C_FLAGS_PLATFORM $LD_SDK_VERSION \ +-Ya,archiver $_LD_ARCHIVER \ +$TOOLCHAIN_ENV ${kv;hide:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} + +LINK_FAT_OBJECT=\ +$_LD_LINK_FAT_PREFIX \ +--obj=$TARGET --lib=${output:REALPRJNAME.a} \ +$_LD_LINK_FAT_SUFFIX1 \ +$_LD_LINK_FAT_SRCS_GLOBALS_WA \ +$_LD_LINK_FAT_SUFFIX2 + +LINK_RECURSIVE_LIBRARY=\ +$_LD_LINK_FAT_PREFIX \ +--lib=$TARGET --with-own-obj --with-global-srcs \ +$_LD_LINK_FAT_SUFFIX1 \ +$_LD_LINK_FAT_SRCS_GLOBALS_NO_WA \ +$_LD_LINK_FAT_SUFFIX2 + +LINK_FAT_OBJECT_LIBRARY=\ +$_LD_LINK_FAT_PREFIX \ +--lib=$TARGET $FAT_OBJECT_ARGS $FAT_OBJECT_OUTS \ +$_LD_LINK_FAT_SUFFIX1 \ +$_LD_LINK_FAT_SRCS_GLOBALS_NO_WA \ +$_LD_LINK_FAT_SUFFIX2 + +LIBRT=-lrt +MD5LIB=-lcrypt +LIBRESOLV= +when ($OS_LINUX || $OS_DARWIN || $OS_ANDROID) { + LIBRESOLV=-lresolv +} +PROFFLAG=-pg diff --git a/build/conf/linkers/msvc_linker.conf b/build/conf/linkers/msvc_linker.conf index e905024bda..c956fbab97 100644 --- a/build/conf/linkers/msvc_linker.conf +++ b/build/conf/linkers/msvc_linker.conf @@ -1,271 +1,271 @@ -_MSVC_ARCH= -when ($ARCH_I386 == "yes" || $ARCH_I686 == "yes") { - _MSVC_ARCH=x86 -} -elsewhen ($ARCH_X86_64 == "yes") { - _MSVC_ARCH=x64 -} -elsewhen ($ARCH_ARM == "yes") { - _MSVC_ARCH=arm -} - -_FLAGS_MACHINE=/MACHINE:${toupper:_MSVC_ARCH} - -_FLAGS_IGNORE=/IGNORE:4221 - -_FLAGS_COMMON_IDE_MSVS= -when ($IDE_MSVS == "yes") { - _FLAGS_COMMON_IDE_MSVS=/INCREMENTAL -} -otherwise { - _FLAGS_COMMON_IDE_MSVS=/INCREMENTAL:NO -} - -# TODO(nslus): DEVTOOLS-1868 remove restriction. -_FLAGS_DEBUG_ONLY_DEBUG= -_FLAGS_RELEASE_ONLY_DEBUG= -_FLAGS_COMMON_DEBUG= -when (!$NO_DEBUGINFO || $NO_DEBUGINFO == "no" || $NO_DEBUGINFO == "0") { - when ($IDE_MSVS == "yes") { - when ($CLANG_CL == "yes") { - _FLAGS_DEBUG_ONLY_DEBUG=/DEBUG - } - otherwise { - _FLAGS_DEBUG_ONLY_DEBUG=/DEBUG:FASTLINK - } - _FLAGS_RELEASE_ONLY_DEBUG=/DEBUG - } - otherwise { - _FLAGS_COMMON_DEBUG=/DEBUG - } -} - -_FLAGS_COMMON_LIBPATHS= -when ($IDE_MSVS != "yes") { - _FLAGS_COMMON_LIBPATHS=\ -/LIBPATH:"$_MSVC_TC_KIT_LIBS/um/$_MSVC_ARCH" \ -/LIBPATH:"$_MSVC_TC_KIT_LIBS/ucrt/$_MSVC_ARCH" \ -/LIBPATH:"$_MSVC_TC_VC_ROOT/lib/$_MSVC_ARCH" -} - -_FLAGS_COMMON =/NOLOGO /ERRORREPORT:PROMPT /SUBSYSTEM:CONSOLE /TLBID:1 $MSVC_DYNAMICBASE /NXCOMPAT -_FLAGS_COMMON+=$_FLAGS_IGNORE -_FLAGS_COMMON+=$_FLAGS_MACHINE -_FLAGS_COMMON+=$_FLAGS_COMMON_IDE_MSVS -_FLAGS_COMMON+=$_FLAGS_COMMON_DEBUG -_FLAGS_COMMON+=$_FLAGS_COMMON_LIBPATHS - -_FLAGS_DEBUG_ONLY_CLANG_CL= -when ($CLANG_CL == "yes") { - _FLAGS_DEBUG_ONLY_CLANG_CL=/STACK:4194304 -} - -_FLAGS_DEBUG_ONLY =$_FLAGS_DEBUG_ONLY_CLANG_CL -_FLAGS_DEBUG_ONLY+=$_FLAGS_DEBUG_ONLY_DEBUG -_FLAGS_RELEASE_ONLY =$_FLAGS_RELEASE_ONLY_DEBUG - -LINK_EXE_FLAGS_DEBUG =$_FLAGS_COMMON -LINK_EXE_FLAGS_DEBUG+=$_FLAGS_DEBUG_ONLY - -LINK_EXE_FLAGS_RELEASE =$_FLAGS_COMMON -LINK_EXE_FLAGS_RELEASE+=$_FLAGS_RELEASE_ONLY - -LINK_LIB_FLAGS=$_FLAGS_IGNORE $_FLAGS_MACHINE - -LINK_STDLIBS=\ -advapi32.lib \ -comdlg32.lib \ -crypt32.lib \ -dnsapi.lib \ -gdi32.lib \ -iphlpapi.lib \ -kernel32.lib \ -mswsock.lib \ -ole32.lib \ -oleaut32.lib \ -psapi.lib \ -rpcrt4.lib \ -secur32.lib \ -shell32.lib \ -shlwapi.lib \ -user32.lib \ -userenv.lib \ -uuid.lib \ -version.lib \ -winmm.lib \ -winspool.lib \ -ws2_32.lib - -LDFLAGS_GLOBAL= -LDFLAGS= -OBJADDE= - -LINK_EXE_FLAGS=$LINK_EXE_FLAGS_PER_TYPE - -LINK_IMPLIB=/IMPLIB:${output;noext;rootrel;pre=$MODULE_PREFIX:REALPRJNAME.lib} -_LINK_EXTRA_OUTPUT= -when (!$NO_DEBUGINFO || $NO_DEBUGINFO == "no" || $NO_DEBUGINFO == "0") { - _LINK_EXTRA_OUTPUT=/PDB:${output;noext;rootrel;pre=$MODULE_PREFIX:REALPRJNAME.pdb} -} -LINK_EXTRA_OUTPUT=$_LINK_EXTRA_OUTPUT - -LIB_WRAPPER=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} lib -LINK_WRAPPER=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} link -when ($_UNDER_WINE == "yes") { - LIB_WRAPPER= - LINK_WRAPPER= -} - -LINK_WRAPPER_DYNLIB=${YMAKE_PYTHON} ${input:"build/scripts/link_dyn_lib.py"} --arch WINDOWS --target $TARGET - -EXPORTS_VALUE= -LINK_IMPLIB_VALUE= -when ($EXPORTS_FILE) { - LINK_IMPLIB_VALUE=$LINK_IMPLIB - EXPORTS_VALUE=/DEF:${input:EXPORTS_FILE} -} - -GENERATE_MF_CMD=\ -$YMAKE_PYTHON ${input:"build/scripts/generate_mf.py"} \ ---build-root $ARCADIA_BUILD_ROOT \ ---module-name $REALPRJNAME \ --o ${output;rootrel;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.mf:REALPRJNAME} \ --t $MODULE_TYPE \ ---ya-start-command-file \ --Ya,lics $LICENSE_NAMES \ --Ya,peers ${rootrel:PEERS} \ --Ya,credits ${input:CREDITS_TEXTS_FILE} $CREDITS_FLAGS \ ---ya-end-command-file - -# we split srcs_global into two groups: libs and objs -# # each group can be in its own command file -# first group need /WHOLEARCHIVE: prefix which will be added in fix_msvc_output.py or run_msvc_wine.py -# the tail of link commands will be added in the third command file -_MSVC_SRCS_GLOBALS=\ ---start-wa --ya-start-command-file ${qe;rootrel;ext=.lib:SRCS_GLOBAL} --ya-end-command-file --end-wa \ ---ya-start-command-file ${qe;rootrel;ext=.obj:SRCS_GLOBAL} --ya-end-command-file - -REAL_LINK_DYN_LIB_CMDLINE=\ -${TOOLCHAIN_ENV} \ -${cwd:ARCADIA_BUILD_ROOT} \ -${LINK_WRAPPER} \ -${LINK_WRAPPER_DYNLIB} \ -${LINK_EXE_CMD} \ -${LINK_IMPLIB_VALUE} \ -/DLL \ -/OUT:${qe;rootrel:TARGET} \ -${LINK_EXTRA_OUTPUT} \ -${EXPORTS_VALUE} \ -${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ -${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ -$_MSVC_SRCS_GLOBALS \ ---ya-start-command-file \ -${VCS_C_OBJ_RR} \ -${qe;rootrel:AUTO_INPUT} \ -${qe;rootrel;ext=.lib:PEERS} ${qe;rootrel;ext=.dll;noext;suf=.lib:PEERS} \ -$LINK_EXE_FLAGS \ -$LINK_STDLIBS $LDFLAGS \ -$LDFLAGS_GLOBAL \ -$OBJADDE \ ---ya-end-command-file - -REAL_LINK_DYN_LIB=$REAL_LINK_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) - -SWIG_DLL_JAR_CMD=$GENERATE_MF && $GENERATE_VCS_C_INFO_NODEP && $REAL_SWIG_DLL_JAR_CMD - -_MSVC_HEAD_LINK_LIB=${TOOLCHAIN_ENV} ${cwd:ARCADIA_BUILD_ROOT} ${LIB_WRAPPER} ${LINK_LIB_CMD} -_MSVC_TAIL_LINK_LIB=\ ---ya-start-command-file \ -${qe;rootrel:AUTO_INPUT} \ -$LINK_LIB_FLAGS \ ---ya-end-command-file \ -${requirements;hide:LIB_REQUIREMENTS} ${hide;kv:"soe"} ${hide;kv:"p AR"} ${hide;kv:"pc light-red"} - -LINK_LIB=${GENERATE_MF} && $_MSVC_HEAD_LINK_LIB /OUT:${qe;rootrel:TARGET} $_MSVC_TAIL_LINK_LIB -GLOBAL_LINK_LIB=$_MSVC_HEAD_LINK_LIB /OUT:${qe;rootrel:GLOBAL_TARGET} $_MSVC_TAIL_LINK_LIB - -LINK_EXE_CMDLINE=\ -${GENERATE_MF} && \ -$GENERATE_VCS_C_INFO_NODEP && \ -${TOOLCHAIN_ENV} \ -${cwd:ARCADIA_BUILD_ROOT} \ -${LINK_WRAPPER} \ -${LINK_EXE_CMD} \ -/OUT:${qe;rootrel:TARGET} \ -${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ -${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ -${LINK_EXTRA_OUTPUT} \ -$_MSVC_SRCS_GLOBALS \ ---ya-start-command-file \ -${VCS_C_OBJ_RR} \ -${qe;rootrel:AUTO_INPUT} \ -$LINK_EXE_FLAGS \ -$LINK_STDLIBS \ -$LDFLAGS \ -$LDFLAGS_GLOBAL \ -$OBJADDE \ -${qe;rootrel;ext=.lib:PEERS} ${qe;rootrel;ext=.dll;noext;suf=.lib:PEERS} \ ---ya-end-command-file \ -${hide;kv:"soe"} ${hide;kv:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${hide;kv:"pc blue"} - -LINK_EXE=$LINK_EXE_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) - -LINK_DYN_LIB=${GENERATE_MF} && $GENERATE_VCS_C_INFO_NODEP && $REAL_LINK_DYN_LIB ${hide;kv:"soe"} ${hide;kv:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${hide;kv:"pc blue"} - -LINK_EXEC_DYN_LIB_CMDLINE=\ -${GENERATE_MF} && \ -$GENERATE_VCS_C_INFO_NODEP && \ -${TOOLCHAIN_ENV} \ -${cwd:ARCADIA_BUILD_ROOT} \ -${LINK_WRAPPER} \ -${LINK_WRAPPER_DYNLIB} \ -${LINK_EXE_CMD} \ -/OUT:${qe;rootrel:TARGET} \ -${LINK_EXTRA_OUTPUT} \ -${EXPORTS_VALUE} \ -${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ -${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ -$_MSVC_SRCS_GLOBALS \ -'--ya-start-command-file \ -${VCS_C_OBJ_RR} \ -${qe;rootrel:AUTO_INPUT} \ -${qe;rootrel;ext=.lib:PEERS} ${qe;rootrel;ext=.dll;noext;suf=.lib:PEERS} \ -$LINK_EXE_FLAGS \ -$LINK_STDLIBS \ -$LDFLAGS $LDFLAGS_GLOBAL \ -$OBJADDE \ ---ya-end-command-file \ -${hide;kv:"soe"} ${hide;kv:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${hide;kv:"pc blue"} - -LINK_EXEC_DYN_LIB=$LINK_EXEC_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) - -LINK_GLOBAL_FAT_OBJECT=\ -${TOOLCHAIN_ENV} \ -${cwd:ARCADIA_BUILD_ROOT} \ -${LIB_WRAPPER} \ -${LINK_LIB_CMD} \ -/OUT:${qe;rootrel:TARGET} \ ---ya-start-command-file \ -${qe;rootrel;ext=.lib:SRCS_GLOBAL} \ -${qe;rootrel;ext=.obj:SRCS_GLOBAL} \ -${qe;rootrel:AUTO_INPUT} \ -$LINK_LIB_FLAGS \ ---ya-end-command-file - -LINK_PEERS_FAT_OBJECT=\ -${TOOLCHAIN_ENV} \ -${cwd:ARCADIA_BUILD_ROOT} \ -${LIB_WRAPPER} \ -${LINK_LIB_CMD} \ -/OUT:${qe;rootrel;output:REALPRJNAME.lib} \ ---ya-start-command-file \ -${qe;rootrel:PEERS} \ -$LINK_LIB_FLAGS \ ---ya-end-command-file - -LINK_FAT_OBJECT=\ -${GENERATE_MF} && \ -$GENERATE_VCS_C_INFO_NODEP && \ -$LINK_GLOBAL_FAT_OBJECT && \ -$LINK_PEERS_FAT_OBJECT \ -${kv;hide:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} +_MSVC_ARCH= +when ($ARCH_I386 == "yes" || $ARCH_I686 == "yes") { + _MSVC_ARCH=x86 +} +elsewhen ($ARCH_X86_64 == "yes") { + _MSVC_ARCH=x64 +} +elsewhen ($ARCH_ARM == "yes") { + _MSVC_ARCH=arm +} + +_FLAGS_MACHINE=/MACHINE:${toupper:_MSVC_ARCH} + +_FLAGS_IGNORE=/IGNORE:4221 + +_FLAGS_COMMON_IDE_MSVS= +when ($IDE_MSVS == "yes") { + _FLAGS_COMMON_IDE_MSVS=/INCREMENTAL +} +otherwise { + _FLAGS_COMMON_IDE_MSVS=/INCREMENTAL:NO +} + +# TODO(nslus): DEVTOOLS-1868 remove restriction. +_FLAGS_DEBUG_ONLY_DEBUG= +_FLAGS_RELEASE_ONLY_DEBUG= +_FLAGS_COMMON_DEBUG= +when (!$NO_DEBUGINFO || $NO_DEBUGINFO == "no" || $NO_DEBUGINFO == "0") { + when ($IDE_MSVS == "yes") { + when ($CLANG_CL == "yes") { + _FLAGS_DEBUG_ONLY_DEBUG=/DEBUG + } + otherwise { + _FLAGS_DEBUG_ONLY_DEBUG=/DEBUG:FASTLINK + } + _FLAGS_RELEASE_ONLY_DEBUG=/DEBUG + } + otherwise { + _FLAGS_COMMON_DEBUG=/DEBUG + } +} + +_FLAGS_COMMON_LIBPATHS= +when ($IDE_MSVS != "yes") { + _FLAGS_COMMON_LIBPATHS=\ +/LIBPATH:"$_MSVC_TC_KIT_LIBS/um/$_MSVC_ARCH" \ +/LIBPATH:"$_MSVC_TC_KIT_LIBS/ucrt/$_MSVC_ARCH" \ +/LIBPATH:"$_MSVC_TC_VC_ROOT/lib/$_MSVC_ARCH" +} + +_FLAGS_COMMON =/NOLOGO /ERRORREPORT:PROMPT /SUBSYSTEM:CONSOLE /TLBID:1 $MSVC_DYNAMICBASE /NXCOMPAT +_FLAGS_COMMON+=$_FLAGS_IGNORE +_FLAGS_COMMON+=$_FLAGS_MACHINE +_FLAGS_COMMON+=$_FLAGS_COMMON_IDE_MSVS +_FLAGS_COMMON+=$_FLAGS_COMMON_DEBUG +_FLAGS_COMMON+=$_FLAGS_COMMON_LIBPATHS + +_FLAGS_DEBUG_ONLY_CLANG_CL= +when ($CLANG_CL == "yes") { + _FLAGS_DEBUG_ONLY_CLANG_CL=/STACK:4194304 +} + +_FLAGS_DEBUG_ONLY =$_FLAGS_DEBUG_ONLY_CLANG_CL +_FLAGS_DEBUG_ONLY+=$_FLAGS_DEBUG_ONLY_DEBUG +_FLAGS_RELEASE_ONLY =$_FLAGS_RELEASE_ONLY_DEBUG + +LINK_EXE_FLAGS_DEBUG =$_FLAGS_COMMON +LINK_EXE_FLAGS_DEBUG+=$_FLAGS_DEBUG_ONLY + +LINK_EXE_FLAGS_RELEASE =$_FLAGS_COMMON +LINK_EXE_FLAGS_RELEASE+=$_FLAGS_RELEASE_ONLY + +LINK_LIB_FLAGS=$_FLAGS_IGNORE $_FLAGS_MACHINE + +LINK_STDLIBS=\ +advapi32.lib \ +comdlg32.lib \ +crypt32.lib \ +dnsapi.lib \ +gdi32.lib \ +iphlpapi.lib \ +kernel32.lib \ +mswsock.lib \ +ole32.lib \ +oleaut32.lib \ +psapi.lib \ +rpcrt4.lib \ +secur32.lib \ +shell32.lib \ +shlwapi.lib \ +user32.lib \ +userenv.lib \ +uuid.lib \ +version.lib \ +winmm.lib \ +winspool.lib \ +ws2_32.lib + +LDFLAGS_GLOBAL= +LDFLAGS= +OBJADDE= + +LINK_EXE_FLAGS=$LINK_EXE_FLAGS_PER_TYPE + +LINK_IMPLIB=/IMPLIB:${output;noext;rootrel;pre=$MODULE_PREFIX:REALPRJNAME.lib} +_LINK_EXTRA_OUTPUT= +when (!$NO_DEBUGINFO || $NO_DEBUGINFO == "no" || $NO_DEBUGINFO == "0") { + _LINK_EXTRA_OUTPUT=/PDB:${output;noext;rootrel;pre=$MODULE_PREFIX:REALPRJNAME.pdb} +} +LINK_EXTRA_OUTPUT=$_LINK_EXTRA_OUTPUT + +LIB_WRAPPER=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} lib +LINK_WRAPPER=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} link +when ($_UNDER_WINE == "yes") { + LIB_WRAPPER= + LINK_WRAPPER= +} + +LINK_WRAPPER_DYNLIB=${YMAKE_PYTHON} ${input:"build/scripts/link_dyn_lib.py"} --arch WINDOWS --target $TARGET + +EXPORTS_VALUE= +LINK_IMPLIB_VALUE= +when ($EXPORTS_FILE) { + LINK_IMPLIB_VALUE=$LINK_IMPLIB + EXPORTS_VALUE=/DEF:${input:EXPORTS_FILE} +} + +GENERATE_MF_CMD=\ +$YMAKE_PYTHON ${input:"build/scripts/generate_mf.py"} \ +--build-root $ARCADIA_BUILD_ROOT \ +--module-name $REALPRJNAME \ +-o ${output;rootrel;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.mf:REALPRJNAME} \ +-t $MODULE_TYPE \ +--ya-start-command-file \ +-Ya,lics $LICENSE_NAMES \ +-Ya,peers ${rootrel:PEERS} \ +-Ya,credits ${input:CREDITS_TEXTS_FILE} $CREDITS_FLAGS \ +--ya-end-command-file + +# we split srcs_global into two groups: libs and objs +# # each group can be in its own command file +# first group need /WHOLEARCHIVE: prefix which will be added in fix_msvc_output.py or run_msvc_wine.py +# the tail of link commands will be added in the third command file +_MSVC_SRCS_GLOBALS=\ +--start-wa --ya-start-command-file ${qe;rootrel;ext=.lib:SRCS_GLOBAL} --ya-end-command-file --end-wa \ +--ya-start-command-file ${qe;rootrel;ext=.obj:SRCS_GLOBAL} --ya-end-command-file + +REAL_LINK_DYN_LIB_CMDLINE=\ +${TOOLCHAIN_ENV} \ +${cwd:ARCADIA_BUILD_ROOT} \ +${LINK_WRAPPER} \ +${LINK_WRAPPER_DYNLIB} \ +${LINK_EXE_CMD} \ +${LINK_IMPLIB_VALUE} \ +/DLL \ +/OUT:${qe;rootrel:TARGET} \ +${LINK_EXTRA_OUTPUT} \ +${EXPORTS_VALUE} \ +${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ +${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ +$_MSVC_SRCS_GLOBALS \ +--ya-start-command-file \ +${VCS_C_OBJ_RR} \ +${qe;rootrel:AUTO_INPUT} \ +${qe;rootrel;ext=.lib:PEERS} ${qe;rootrel;ext=.dll;noext;suf=.lib:PEERS} \ +$LINK_EXE_FLAGS \ +$LINK_STDLIBS $LDFLAGS \ +$LDFLAGS_GLOBAL \ +$OBJADDE \ +--ya-end-command-file + +REAL_LINK_DYN_LIB=$REAL_LINK_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) + +SWIG_DLL_JAR_CMD=$GENERATE_MF && $GENERATE_VCS_C_INFO_NODEP && $REAL_SWIG_DLL_JAR_CMD + +_MSVC_HEAD_LINK_LIB=${TOOLCHAIN_ENV} ${cwd:ARCADIA_BUILD_ROOT} ${LIB_WRAPPER} ${LINK_LIB_CMD} +_MSVC_TAIL_LINK_LIB=\ +--ya-start-command-file \ +${qe;rootrel:AUTO_INPUT} \ +$LINK_LIB_FLAGS \ +--ya-end-command-file \ +${requirements;hide:LIB_REQUIREMENTS} ${hide;kv:"soe"} ${hide;kv:"p AR"} ${hide;kv:"pc light-red"} + +LINK_LIB=${GENERATE_MF} && $_MSVC_HEAD_LINK_LIB /OUT:${qe;rootrel:TARGET} $_MSVC_TAIL_LINK_LIB +GLOBAL_LINK_LIB=$_MSVC_HEAD_LINK_LIB /OUT:${qe;rootrel:GLOBAL_TARGET} $_MSVC_TAIL_LINK_LIB + +LINK_EXE_CMDLINE=\ +${GENERATE_MF} && \ +$GENERATE_VCS_C_INFO_NODEP && \ +${TOOLCHAIN_ENV} \ +${cwd:ARCADIA_BUILD_ROOT} \ +${LINK_WRAPPER} \ +${LINK_EXE_CMD} \ +/OUT:${qe;rootrel:TARGET} \ +${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ +${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ +${LINK_EXTRA_OUTPUT} \ +$_MSVC_SRCS_GLOBALS \ +--ya-start-command-file \ +${VCS_C_OBJ_RR} \ +${qe;rootrel:AUTO_INPUT} \ +$LINK_EXE_FLAGS \ +$LINK_STDLIBS \ +$LDFLAGS \ +$LDFLAGS_GLOBAL \ +$OBJADDE \ +${qe;rootrel;ext=.lib:PEERS} ${qe;rootrel;ext=.dll;noext;suf=.lib:PEERS} \ +--ya-end-command-file \ +${hide;kv:"soe"} ${hide;kv:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${hide;kv:"pc blue"} + +LINK_EXE=$LINK_EXE_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) + +LINK_DYN_LIB=${GENERATE_MF} && $GENERATE_VCS_C_INFO_NODEP && $REAL_LINK_DYN_LIB ${hide;kv:"soe"} ${hide;kv:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${hide;kv:"pc blue"} + +LINK_EXEC_DYN_LIB_CMDLINE=\ +${GENERATE_MF} && \ +$GENERATE_VCS_C_INFO_NODEP && \ +${TOOLCHAIN_ENV} \ +${cwd:ARCADIA_BUILD_ROOT} \ +${LINK_WRAPPER} \ +${LINK_WRAPPER_DYNLIB} \ +${LINK_EXE_CMD} \ +/OUT:${qe;rootrel:TARGET} \ +${LINK_EXTRA_OUTPUT} \ +${EXPORTS_VALUE} \ +${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \ +${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \ +$_MSVC_SRCS_GLOBALS \ +'--ya-start-command-file \ +${VCS_C_OBJ_RR} \ +${qe;rootrel:AUTO_INPUT} \ +${qe;rootrel;ext=.lib:PEERS} ${qe;rootrel;ext=.dll;noext;suf=.lib:PEERS} \ +$LINK_EXE_FLAGS \ +$LINK_STDLIBS \ +$LDFLAGS $LDFLAGS_GLOBAL \ +$OBJADDE \ +--ya-end-command-file \ +${hide;kv:"soe"} ${hide;kv:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${hide;kv:"pc blue"} + +LINK_EXEC_DYN_LIB=$LINK_EXEC_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE) + +LINK_GLOBAL_FAT_OBJECT=\ +${TOOLCHAIN_ENV} \ +${cwd:ARCADIA_BUILD_ROOT} \ +${LIB_WRAPPER} \ +${LINK_LIB_CMD} \ +/OUT:${qe;rootrel:TARGET} \ +--ya-start-command-file \ +${qe;rootrel;ext=.lib:SRCS_GLOBAL} \ +${qe;rootrel;ext=.obj:SRCS_GLOBAL} \ +${qe;rootrel:AUTO_INPUT} \ +$LINK_LIB_FLAGS \ +--ya-end-command-file + +LINK_PEERS_FAT_OBJECT=\ +${TOOLCHAIN_ENV} \ +${cwd:ARCADIA_BUILD_ROOT} \ +${LIB_WRAPPER} \ +${LINK_LIB_CMD} \ +/OUT:${qe;rootrel;output:REALPRJNAME.lib} \ +--ya-start-command-file \ +${qe;rootrel:PEERS} \ +$LINK_LIB_FLAGS \ +--ya-end-command-file + +LINK_FAT_OBJECT=\ +${GENERATE_MF} && \ +$GENERATE_VCS_C_INFO_NODEP && \ +$LINK_GLOBAL_FAT_OBJECT && \ +$LINK_PEERS_FAT_OBJECT \ +${kv;hide:"p LD"} ${requirements;hide:LD_REQUIREMENTS} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"} diff --git a/build/conf/project_specific/maps/mapkit.conf b/build/conf/project_specific/maps/mapkit.conf index d64b41f72a..be4b1002ac 100644 --- a/build/conf/project_specific/maps/mapkit.conf +++ b/build/conf/project_specific/maps/mapkit.conf @@ -17,7 +17,7 @@ macro MAPS_IDL_ADDINCL(Dirs...) { macro _MAPKITIDL_PROXY(Args...) { MAPKITIDL($Args) ENABLE(USE_YMAKE_RESOURCE) - SET_APPEND(_MAKEFILE_INCLUDE_LIKE_TEXT_DEPS ${ext=idl:Args}) + SET_APPEND(_MAKEFILE_INCLUDE_LIKE_TEXT_DEPS ${ext=idl:Args}) } MAPS_IDL_FILTER= diff --git a/build/conf/settings.conf b/build/conf/settings.conf index 4329f3233a..0e9c754b64 100644 --- a/build/conf/settings.conf +++ b/build/conf/settings.conf @@ -2,154 +2,154 @@ GLOBAL_SRCS_IN_RESULTS=yes JSON_CACHE_IS_ATTACHED=yes USE_ADDINCL_WITHOUT_FOR_AS_ADDINCL_FOR_C=yes LANGS_REQUIRE_BUILD_AND_SRC_ROOTS=c asm cython proto flatc swig ydl nlg - -# NOTE! Only foldable vars should be listed here -_FOLDABLE_VARS_=\ - CL_WRAPPER \ - END_WHOLE_ARCHIVE_VALUE \ - LD_SDK_VERSION \ - LD_STRIP_FLAG \ - LIB_WRAPPER \ - LINK_EXE_FLAGS_DEBUG \ - LINK_EXE_FLAGS_RELEASE \ - LINK_IMPLIB \ - LINK_LIB_FLAGS \ - LINK_STDLIBS \ - LINK_WRAPPER \ - LINK_WRAPPER_DYNLIB \ - ML_WRAPPER \ - START_WHOLE_ARCHIVE_VALUE \ - _CFLAGS_ARCH_I386 \ - _CFLAGS_UCRT_VC_INCLUDES \ - _COMPILER_TIME_TRACE_FLAGS \ - _COMPILER_TIME_TRACE_GRANULARITY \ - _COMPILER_TIME_TRACE_POSTPROCESS \ - _CPP_ARGS \ - _CROSS_SUFFIX \ - _CXX_DEFINES \ - _CXX_FLAGS \ - _CXX_STD \ - _CXX_WARNINGS \ - _CXX_WARNINGS_CLANG \ - _CXX_WARNINGS_CLANG_CL \ - _CXX_WARNINGS_CLANG_CL_2019 \ - _CXX_WARNINGS_CLANG_CL_2019_IDE_MSVS \ - _CXX_WARNINGS_GCC_7 \ - _C_ARGS \ - _C_CPP_KV_STYLE \ - _C_DEFINES \ - _C_DEFINES_ANDROID \ - _C_DEFINES_ANDROID_OTHERWISE \ - _C_DEFINES_CLANG_LINUX_X86_64 \ - _C_DEFINES_GNU_SOURCE \ - _C_DEFINES_IOS \ - _C_DEFINES_NDEBUG \ - _C_DEFINES_WITH_VALGRIND \ - _C_FLAGS \ - _C_FLAGS_ARCH \ - _C_FLAGS_ARCH_OPT \ - _C_FLAGS_FAST_DEBUG \ - _C_FLAGS_PROFILER \ - _C_FLAGS_RELEASE \ - _C_FOPTIONS \ - _C_FOPTIONS_ALIGNED_ALLOCATION \ - _C_FOPTIONS_CLANG_10 \ - _C_FOPTIONS_CLANG_10_LINUX \ - _C_FOPTIONS_COLOR \ - _C_FOPTIONS_COVERAGE \ - _C_FOPTIONS_DEBUG \ - _C_FOPTIONS_GCC \ - _C_FOPTIONS_INIT_ARRAY \ - _C_FOPTIONS_IOS \ - _C_FOPTIONS_MAPSMOBI_ARM \ - _C_FOPTIONS_PROFILER \ - _C_FOPTIONS_RELEASE \ - _C_SYSTEM_LIBRARIES \ - _C_WARNINGS \ - _C_WARNINGS_CLANG \ - _C_WARNINGS_CLANG_CL \ - _DEBUG_INFO_FLAGS \ - _DEFINES_ARCH \ - _DEFINES_UNICODE \ - _DEFINES_WIN32_WINNT \ - _DWARF_COMMAND \ - _END_GROUP \ - _EXEC_SHARED_FLAG \ - _EXE_FLAGS \ - _FLAGS_COMMON \ - _FLAGS_COMMON_DEBUG \ - _FLAGS_COMMON_IDE_MSVS \ - _FLAGS_COMMON_LIBPATHS \ - _FLAGS_C_ONLY \ - _FLAGS_DEBUG_ONLY \ - _FLAGS_DEBUG_ONLY_CLANG_CL \ - _FLAGS_DEBUG_ONLY_DEBUG \ - _FLAGS_DEBUG_RUNTIME \ - _FLAGS_IGNORE \ - _FLAGS_MACHINE \ - _FLAGS_MSVS_ONLY \ - _FLAGS_RELEASE_ONLY \ - _FLAGS_RELEASE_ONLY_DEBUG \ - _FLAGS_RELEASE_RUNTIME \ - _LD_ARCHIVER \ - _LD_ARCH_FLAG \ - _LD_AR_PLUGIN \ - _LD_DCE_FLAG_GC_SECTIONS \ - _LD_DCE_FLAG_PRINT_SECTIONS \ - _LD_ENV_STYLE \ - _LD_FLAGS \ - _LD_FLAGS_1 \ - _LD_FLAGS_2 \ - _LD_FLAGS_COVERAGE \ - _LD_FLAGS_IOS_MAPSMOBI_ARM \ - _LD_FLAGS_PROFILER_TYPE \ - _LD_FLAGS_SIZE_OPTIMIZED \ - _LD_ICF_FLAG \ - _LD_ICF_FLAG_PRINT_SECTIONS \ - _LD_LIB_GENERATE_MF \ - _LD_LINKER_OUTPUT\ - _LD_LINKER_OUTPUT_FLAG \ - _LD_LINK_FAT_PREFIX \ - _LD_LINK_FAT_SRCS_GLOBALS_NO_WA \ - _LD_LINK_FAT_SRCS_GLOBALS_WA \ - _LD_LINK_FAT_SUFFIX1 \ - _LD_LINK_FAT_SUFFIX2 \ - _LD_LLVM_AR_FORMAT \ - _LD_SRCS_GLOBALS \ - _LD_SYS_LIB \ - _LD_TAIL_LINK_LIB \ - _LD_THREAD_LIBRARY \ - _LD_USE_STDLIB \ - _LINKER_TIME_TRACE_FLAG \ - _LINKER_TIME_TRACE_GRANULARITY \ - _LINK_EXTRA_OUTPUT \ - _MASM_IO \ - _MSVC_ARCH \ - _MSVC_FLAGS \ - _MSVC_FLAGS_ARCH_OPT \ - _MSVC_FLAGS_CLANG \ - _MSVC_FLAGS_CLANG_ARCH \ - _MSVC_FLAGS_CLANG_EQ_2019 \ - _MSVC_FLAGS_CLANG_NO_WARNINGS \ - _MSVC_FLAGS_INCLUDE \ - _MSVC_HEAD_LINK_LIB \ - _MSVC_MACRO \ - _MSVC_SRCS_GLOBALS \ - _MSVC_TAIL_LINK_LIB \ - _MSVC_TC_KIT_LIBS \ - _MSVC_TC_VC_ROOT \ - _MSVC_WARNS_AS_ERRORS \ - _MSVC_WARNS_DISABLED \ - _MSVC_WARNS_ENABLED \ - _MSVC_WINDOWS7 \ - _MSVC_WINDOWS8 \ - _OPTIMIZE_RELEASE \ - _SFDL_FLAGS \ - _SHARED_FLAG \ - _SONAME_FLAG \ - _SONAME_OPTION \ - _START_GROUP \ - _STD_CXX \ - _WINAPI_UNICODE \ - -# end of _FOLDABLE_VARS list + +# NOTE! Only foldable vars should be listed here +_FOLDABLE_VARS_=\ + CL_WRAPPER \ + END_WHOLE_ARCHIVE_VALUE \ + LD_SDK_VERSION \ + LD_STRIP_FLAG \ + LIB_WRAPPER \ + LINK_EXE_FLAGS_DEBUG \ + LINK_EXE_FLAGS_RELEASE \ + LINK_IMPLIB \ + LINK_LIB_FLAGS \ + LINK_STDLIBS \ + LINK_WRAPPER \ + LINK_WRAPPER_DYNLIB \ + ML_WRAPPER \ + START_WHOLE_ARCHIVE_VALUE \ + _CFLAGS_ARCH_I386 \ + _CFLAGS_UCRT_VC_INCLUDES \ + _COMPILER_TIME_TRACE_FLAGS \ + _COMPILER_TIME_TRACE_GRANULARITY \ + _COMPILER_TIME_TRACE_POSTPROCESS \ + _CPP_ARGS \ + _CROSS_SUFFIX \ + _CXX_DEFINES \ + _CXX_FLAGS \ + _CXX_STD \ + _CXX_WARNINGS \ + _CXX_WARNINGS_CLANG \ + _CXX_WARNINGS_CLANG_CL \ + _CXX_WARNINGS_CLANG_CL_2019 \ + _CXX_WARNINGS_CLANG_CL_2019_IDE_MSVS \ + _CXX_WARNINGS_GCC_7 \ + _C_ARGS \ + _C_CPP_KV_STYLE \ + _C_DEFINES \ + _C_DEFINES_ANDROID \ + _C_DEFINES_ANDROID_OTHERWISE \ + _C_DEFINES_CLANG_LINUX_X86_64 \ + _C_DEFINES_GNU_SOURCE \ + _C_DEFINES_IOS \ + _C_DEFINES_NDEBUG \ + _C_DEFINES_WITH_VALGRIND \ + _C_FLAGS \ + _C_FLAGS_ARCH \ + _C_FLAGS_ARCH_OPT \ + _C_FLAGS_FAST_DEBUG \ + _C_FLAGS_PROFILER \ + _C_FLAGS_RELEASE \ + _C_FOPTIONS \ + _C_FOPTIONS_ALIGNED_ALLOCATION \ + _C_FOPTIONS_CLANG_10 \ + _C_FOPTIONS_CLANG_10_LINUX \ + _C_FOPTIONS_COLOR \ + _C_FOPTIONS_COVERAGE \ + _C_FOPTIONS_DEBUG \ + _C_FOPTIONS_GCC \ + _C_FOPTIONS_INIT_ARRAY \ + _C_FOPTIONS_IOS \ + _C_FOPTIONS_MAPSMOBI_ARM \ + _C_FOPTIONS_PROFILER \ + _C_FOPTIONS_RELEASE \ + _C_SYSTEM_LIBRARIES \ + _C_WARNINGS \ + _C_WARNINGS_CLANG \ + _C_WARNINGS_CLANG_CL \ + _DEBUG_INFO_FLAGS \ + _DEFINES_ARCH \ + _DEFINES_UNICODE \ + _DEFINES_WIN32_WINNT \ + _DWARF_COMMAND \ + _END_GROUP \ + _EXEC_SHARED_FLAG \ + _EXE_FLAGS \ + _FLAGS_COMMON \ + _FLAGS_COMMON_DEBUG \ + _FLAGS_COMMON_IDE_MSVS \ + _FLAGS_COMMON_LIBPATHS \ + _FLAGS_C_ONLY \ + _FLAGS_DEBUG_ONLY \ + _FLAGS_DEBUG_ONLY_CLANG_CL \ + _FLAGS_DEBUG_ONLY_DEBUG \ + _FLAGS_DEBUG_RUNTIME \ + _FLAGS_IGNORE \ + _FLAGS_MACHINE \ + _FLAGS_MSVS_ONLY \ + _FLAGS_RELEASE_ONLY \ + _FLAGS_RELEASE_ONLY_DEBUG \ + _FLAGS_RELEASE_RUNTIME \ + _LD_ARCHIVER \ + _LD_ARCH_FLAG \ + _LD_AR_PLUGIN \ + _LD_DCE_FLAG_GC_SECTIONS \ + _LD_DCE_FLAG_PRINT_SECTIONS \ + _LD_ENV_STYLE \ + _LD_FLAGS \ + _LD_FLAGS_1 \ + _LD_FLAGS_2 \ + _LD_FLAGS_COVERAGE \ + _LD_FLAGS_IOS_MAPSMOBI_ARM \ + _LD_FLAGS_PROFILER_TYPE \ + _LD_FLAGS_SIZE_OPTIMIZED \ + _LD_ICF_FLAG \ + _LD_ICF_FLAG_PRINT_SECTIONS \ + _LD_LIB_GENERATE_MF \ + _LD_LINKER_OUTPUT\ + _LD_LINKER_OUTPUT_FLAG \ + _LD_LINK_FAT_PREFIX \ + _LD_LINK_FAT_SRCS_GLOBALS_NO_WA \ + _LD_LINK_FAT_SRCS_GLOBALS_WA \ + _LD_LINK_FAT_SUFFIX1 \ + _LD_LINK_FAT_SUFFIX2 \ + _LD_LLVM_AR_FORMAT \ + _LD_SRCS_GLOBALS \ + _LD_SYS_LIB \ + _LD_TAIL_LINK_LIB \ + _LD_THREAD_LIBRARY \ + _LD_USE_STDLIB \ + _LINKER_TIME_TRACE_FLAG \ + _LINKER_TIME_TRACE_GRANULARITY \ + _LINK_EXTRA_OUTPUT \ + _MASM_IO \ + _MSVC_ARCH \ + _MSVC_FLAGS \ + _MSVC_FLAGS_ARCH_OPT \ + _MSVC_FLAGS_CLANG \ + _MSVC_FLAGS_CLANG_ARCH \ + _MSVC_FLAGS_CLANG_EQ_2019 \ + _MSVC_FLAGS_CLANG_NO_WARNINGS \ + _MSVC_FLAGS_INCLUDE \ + _MSVC_HEAD_LINK_LIB \ + _MSVC_MACRO \ + _MSVC_SRCS_GLOBALS \ + _MSVC_TAIL_LINK_LIB \ + _MSVC_TC_KIT_LIBS \ + _MSVC_TC_VC_ROOT \ + _MSVC_WARNS_AS_ERRORS \ + _MSVC_WARNS_DISABLED \ + _MSVC_WARNS_ENABLED \ + _MSVC_WINDOWS7 \ + _MSVC_WINDOWS8 \ + _OPTIMIZE_RELEASE \ + _SFDL_FLAGS \ + _SHARED_FLAG \ + _SONAME_FLAG \ + _SONAME_OPTION \ + _START_GROUP \ + _STD_CXX \ + _WINAPI_UNICODE \ + +# end of _FOLDABLE_VARS list diff --git a/build/conf/toolchains/msvc_toolchain.conf b/build/conf/toolchains/msvc_toolchain.conf index 6b4d6b5c45..794c056776 100644 --- a/build/conf/toolchains/msvc_toolchain.conf +++ b/build/conf/toolchains/msvc_toolchain.conf @@ -1,7 +1,7 @@ -# TODO(somov): Заглушка для тех мест, где C_FLAGS_PLATFORM используется -# для любых платформ. Нужно унифицировать с GnuToolchain. -C_FLAGS_PLATFORM= - -when ($_UNDER_WINE == "yes") { - WINE_ENV=${env:"WINEPREFIX_SUFFIX=4.0"} -} +# TODO(somov): Заглушка для тех мест, где C_FLAGS_PLATFORM используется +# для любых платформ. Нужно унифицировать с GnuToolchain. +C_FLAGS_PLATFORM= + +when ($_UNDER_WINE == "yes") { + WINE_ENV=${env:"WINEPREFIX_SUFFIX=4.0"} +} |