Teach lit to filter the host LDFLAGS down from the build system and into
authorChandler Carruth <chandlerc@gmail.com>
Tue, 21 Oct 2014 00:36:28 +0000 (00:36 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 21 Oct 2014 00:36:28 +0000 (00:36 +0000)
the CGO build environment. This lets things like -rpath propagate down
to the C++ code that is built along side the Go bindings when testing
them.

Patch by Peter Collingbourne, and verified that it works by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220252 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/AddLLVM.cmake
test/Bindings/Go/go.test
test/Bindings/Go/lit.local.cfg
test/Makefile
test/lit.site.cfg.in

index 127d5389d19d6a9ae0db611af96a835f7c788747..81b21fbfb6f42d7142dfa45015c30d8ca9ae0d68 100644 (file)
@@ -657,6 +657,7 @@ function(configure_lit_site_cfg input output)
 
   set(HOST_CC "${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}")
   set(HOST_CXX "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}")
 
   set(HOST_CC "${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}")
   set(HOST_CXX "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}")
+  set(HOST_LDFLAGS "${CMAKE_EXE_LINKER_FLAGS}")
 
   configure_file(${input} ${output} @ONLY)
 endfunction()
 
   configure_file(${input} ${output} @ONLY)
 endfunction()
index ec860ba4acc68882ecf18573b7cb3e4bbe90e37a..ff0cf90e1d8ff3797ab845172c30c944dce99d88 100644 (file)
@@ -2,7 +2,7 @@
 ; RUN: env CGO_CPPFLAGS="$(llvm-config --cppflags)" \
 ; RUN:     CGO_CXXFLAGS=-std=c++11 \
 ; RUN:     CGO_LDFLAGS="$(llvm-config --ldflags --libs --system-libs \
 ; RUN: env CGO_CPPFLAGS="$(llvm-config --cppflags)" \
 ; RUN:     CGO_CXXFLAGS=-std=c++11 \
 ; RUN:     CGO_LDFLAGS="$(llvm-config --ldflags --libs --system-libs \
-; RUN:                                $(../build.sh --print-components))" \
+; RUN:                                $(../build.sh --print-components)) $CGO_LDFLAGS" \
 ; RUN:     %go test -tags byollvm .
 
 ; REQUIRES: shell
 ; RUN:     %go test -tags byollvm .
 
 ; REQUIRES: shell
index f366397a2b2cd2a3b344b15f1e50271ec39b0ae2..e86595b8cb5631f15fa3eb2531db4e53303a242b 100644 (file)
@@ -54,3 +54,4 @@ def fixup_compiler_path(compiler):
 
 config.environment['CC'] = fixup_compiler_path(config.host_cc)
 config.environment['CXX'] = fixup_compiler_path(config.host_cxx)
 
 config.environment['CC'] = fixup_compiler_path(config.host_cc)
 config.environment['CXX'] = fixup_compiler_path(config.host_cxx)
+config.environment['CGO_LDFLAGS'] = config.host_ldflags
index 546266a838f112b3a7d07c35aa9ccb4546c70745..156009d026c1a8f759ed1284a3b57214620b15b9 100644 (file)
@@ -136,6 +136,7 @@ lit.site.cfg: FORCE
        @$(ECHOPATH) s=@GO_EXECUTABLE@=$(GO)=g >> lit.tmp
        @$(ECHOPATH) s!@HOST_CC@!$(CC)!g >> lit.tmp
        @$(ECHOPATH) s!@HOST_CXX@!$(CXX)!g >> lit.tmp
        @$(ECHOPATH) s=@GO_EXECUTABLE@=$(GO)=g >> lit.tmp
        @$(ECHOPATH) s!@HOST_CC@!$(CC)!g >> lit.tmp
        @$(ECHOPATH) s!@HOST_CXX@!$(CXX)!g >> lit.tmp
+       @$(ECHOPATH) s!@HOST_LDFLAGS@!$(LDFLAGS)!g >> lit.tmp
        @$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> lit.tmp
        @$(ECHOPATH) s=@ENABLE_ASSERTIONS@=$(ENABLE_ASSERTIONS)=g >> lit.tmp
        @$(ECHOPATH) s=@TARGETS_TO_BUILD@=$(TARGETS_TO_BUILD)=g >> lit.tmp
        @$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> lit.tmp
        @$(ECHOPATH) s=@ENABLE_ASSERTIONS@=$(ENABLE_ASSERTIONS)=g >> lit.tmp
        @$(ECHOPATH) s=@TARGETS_TO_BUILD@=$(TARGETS_TO_BUILD)=g >> lit.tmp
index 65551c03a87402ad99de61ba11573fca0ced5295..f3141df3268bc4b2def7e5d3144c65ee89705355 100644 (file)
@@ -22,6 +22,7 @@ config.host_os = "@HOST_OS@"
 config.host_arch = "@HOST_ARCH@"
 config.host_cc = "@HOST_CC@"
 config.host_cxx = "@HOST_CXX@"
 config.host_arch = "@HOST_ARCH@"
 config.host_cc = "@HOST_CC@"
 config.host_cxx = "@HOST_CXX@"
+config.host_ldflags = "@HOST_LDFLAGS@"
 config.llvm_use_intel_jitevents = "@LLVM_USE_INTEL_JITEVENTS@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.have_zlib = "@HAVE_LIBZ@"
 config.llvm_use_intel_jitevents = "@LLVM_USE_INTEL_JITEVENTS@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
 config.have_zlib = "@HAVE_LIBZ@"