diff --git a/llvm/tools/llvm-go/llvm-go.go b/llvm/tools/llvm-go/llvm-go.go --- a/llvm/tools/llvm-go/llvm-go.go +++ b/llvm/tools/llvm-go/llvm-go.go @@ -96,11 +96,15 @@ // 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 - ldflags = "-Wl,-rpath," + llvmConfig("--libdir") + " " + ldflags - } + if runtime.GOOS == "aix" { + // AIX linker does not honour `-rpath`, the closest substitution + // is `-blibpath` + ldflags = "-Wl,-blibpath:" + llvmConfig("--libdir") + " " + ldflags + } else if runtime.GOOS != "darwin" { + // OS X doesn't like -rpath with cgo. See: + // https://github.com/golang/go/issues/7293 + ldflags = "-Wl,-rpath," + llvmConfig("--libdir") + " " + ldflags + } return compilerFlags{ cpp: llvmConfig("--cppflags"), cxx: "-std=c++14" + " " + stdLibOption,