@@ -519,8 +519,19 @@ function(add_swift_host_library name)
519
519
target_link_options(${name} PRIVATE
520
520
" LINKER:-current_version,${SWIFT_COMPILER_VERSION} ")
521
521
endif()
522
+
523
+ # For now turn off in swift targets, debug info if we are compiling a static
524
+ # library.
525
+ if (ASHL_STATIC)
526
+ target_compile_options(${name} PRIVATE $<$<COMPILE_LANGUAGE:Swift>:-gnone>)
527
+ endif()
522
528
endif()
523
529
530
+ # If we are compiling in release or release with deb info, compile swift code
531
+ # with -cross-module-optimization enabled.
532
+ target_compile_options(${name} PRIVATE
533
+ $<$<AND:$<COMPILE_LANGUAGE:Swift>,$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>>>:-cross-module-optimization>)
534
+
524
535
add_dependencies(dev ${name} )
525
536
if(NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
526
537
swift_install_in_component(TARGETS ${name}
@@ -566,6 +577,9 @@ function(add_swift_host_tool executable)
566
577
_add_host_variant_c_compile_link_flags(${executable} )
567
578
target_link_directories(${executable} PRIVATE
568
579
${SWIFTLIB_DIR} /${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK} _LIB_SUBDIR})
580
+ # Force executables linker language to be CXX so that we do not link using the
581
+ # host toolchain swiftc.
582
+ set_target_properties(${executable} PROPERTIES LINKER_LANGUAGE CXX)
569
583
add_dependencies(${executable} ${LLVM_COMMON_DEPENDS} )
570
584
571
585
set_target_properties(${executable} PROPERTIES
0 commit comments