[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
Thu May 16 06:30:29 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL360895: [tests][go]Add -stdlib=libc++ to build GO test if LLVM is built with libc++ (authored by xingxue, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61900?vs=199509&id=199811#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61900/new/

https://reviews.llvm.org/D61900

Files:
  llvm/trunk/tools/llvm-go/llvm-go.go


Index: llvm/trunk/tools/llvm-go/llvm-go.go
===================================================================
--- llvm/trunk/tools/llvm-go/llvm-go.go
+++ llvm/trunk/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.199811.patch
Type: text/x-patch
Size: 891 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190516/1922c938/attachment.bin>


More information about the llvm-commits mailing list