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 @@ -97,9 +97,15 @@ 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 { + // 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"),