[llvm] r360895 - [tests][go]Add -stdlib=libc++ to build GO test if LLVM is built with libc++
Xing Xue via llvm-commits
llvm-commits at lists.llvm.org
Thu May 16 06:32:55 PDT 2019
Author: xingxue
Date: Thu May 16 06:32:55 2019
New Revision: 360895
URL: http://llvm.org/viewvc/llvm-project?rev=360895&view=rev
Log:
[tests][go]Add -stdlib=libc++ to build GO test if LLVM is built with libc++
When libc++ is used to build LLVM libraries, these libraries have dependencies on libc++ and C++ STL signatures in these libraries are corresponding to libc++ implementation. Therefore, -stdlib=libc++ is required on the C++ compiler command for building GO tests that link with these LLVM libraries.
Reviewers: hubert.reinterpretcast, sfertile, amyk, EricWF
Reviewed By: sfertile, hubert.reinterpretcast
Subscribers: jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61900
Modified:
llvm/trunk/tools/llvm-go/llvm-go.go
Modified: llvm/trunk/tools/llvm-go/llvm-go.go
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-go/llvm-go.go?rev=360895&r1=360894&r2=360895&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-go/llvm-go.go (original)
+++ llvm/trunk/tools/llvm-go/llvm-go.go Thu May 16 06:32:55 2019
@@ -90,6 +90,12 @@ func llvmConfig(args ...string) string {
func llvmFlags() compilerFlags {
args := append([]string{"--ldflags", "--libs", "--system-libs"}, components...)
ldflags := llvmConfig(args...)
+ stdLibOption := ""
+ if strings.Contains(llvmConfig("--cxxflags"), "-stdlib=libc++") {
+ // If libc++ is used to build LLVM libraries, -stdlib=libc++ is
+ // needed to resolve dependent symbols
+ stdLibOption = "-stdlib=libc++"
+ }
if runtime.GOOS != "darwin" {
// OS X doesn't like -rpath with cgo. See:
// https://github.com/golang/go/issues/7293
@@ -97,7 +103,7 @@ func llvmFlags() compilerFlags {
}
return compilerFlags{
cpp: llvmConfig("--cppflags"),
- cxx: "-std=c++11",
+ cxx: "-std=c++11" + " " + stdLibOption,
ld: ldflags,
}
}
More information about the llvm-commits
mailing list