[PATCH] D61900: [tests][go]Add -stdlib=libc++ to build GO test if LLVM is built with libc++
Xing Xue via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 14 08:00:13 PDT 2019
xingxue created this revision.
xingxue added reviewers: hubert.reinterpretcast, sfertile, amyk.
xingxue added a project: LLVM.
Herald added a reviewer: EricWF.
Herald added a subscriber: jsji.
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.
Repository:
rL LLVM
https://reviews.llvm.org/D61900
Files:
llvm/tools/llvm-go/llvm-go.go
Index: llvm/tools/llvm-go/llvm-go.go
===================================================================
--- llvm/tools/llvm-go/llvm-go.go
+++ llvm/tools/llvm-go/llvm-go.go
@@ -90,6 +90,12 @@
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 @@
}
return compilerFlags{
cpp: llvmConfig("--cppflags"),
- cxx: "-std=c++11",
+ cxx: "-std=c++11" + " " + stdLibOption,
ld: ldflags,
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61900.199442.patch
Type: text/x-patch
Size: 936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190514/d8c19d99/attachment.bin>
More information about the llvm-commits
mailing list