CGO: use correct linker and linker flags when linking GO_PROGRAM module
@@ -3679,12 +3679,12 @@ module GO_BASE_UNIT: BASE_UNIT {
when ($OS_DARWIN) {
GO_TOOLCHAIN_ENV += ${env:"CC=clang"} ${env:"PATH=$(DEFAULT_DARWIN_X86_64)/bin:$MACOS_SDK_RESOURCE_GLOBAL/usr/bin:$CCTOOLS_ROOT_RESOURCE_GLOBAL/bin"}
- GO_EXTLD = ++extld clang ++extldflags $LD_SDK_VERSION -undefined dynamic_lookup $C_FLAGS_PLATFORM --sysroot=$MACOS_SDK_RESOURCE_GLOBAL $GO_LDFLAGS_GLOBAL
+ GO_EXTLD = ++extld clang ++extldflags $LD_SDK_VERSION -undefined dynamic_lookup $C_FLAGS_PLATFORM --sysroot=$MACOS_SDK_RESOURCE_GLOBAL $LDFLAGS $LDFLAGS_GLOBAL $GO_LDFLAGS_GLOBAL
CGO2_LDFLAGS += $LD_SDK_VERSION -undefined dynamic_lookup
}
elsewhen ($OS_LINUX) {
GO_TOOLCHAIN_ENV += ${env:"CC=clang"} ${env:"PATH=$(DEFAULT_LINUX_X86_64)/bin:$OS_SDK_ROOT_RESOURCE_GLOBAL/usr/bin"}
- GO_EXTLD = ++extld clang ++extldflags $C_FLAGS_PLATFORM --sysroot=$OS_SDK_ROOT_RESOURCE_GLOBAL $GO_LDFLAGS_GLOBAL
+ GO_EXTLD = ++extld clang ++extldflags $C_FLAGS_PLATFORM --sysroot=$OS_SDK_ROOT_RESOURCE_GLOBAL $LDFLAGS $LDFLAGS_GLOBAL $GO_LDFLAGS_GLOBAL
CGO2_LDFLAGS += -Wl,--unresolved-symbols=ignore-all
}
otherwise {
@@ -3706,6 +3706,8 @@ module GO_PROGRAM: GO_BASE_UNIT {
.SYMLINK_POLICY=EXE
SET(MODULE_TYPE PROGRAM)
+ USE_LINKER()
+
when ($MSVC == "yes" || $CYGWIN == "yes") {
MODULE_SUFFIX=.exe
}
