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, } }