Skip to content

Commit

Permalink
[AIX][llvm-go] AIX linker does not recognize -rpath
Browse files Browse the repository at this point in the history
The existing logic adds `-rpath` to CGO_LDFLAGS, which is not a valid linker option on AIX. This patch substitutes it with `-blibpath` on AIX.

Reviewed By: daltenty

Differential Revision: https://reviews.llvm.org/D113704
  • Loading branch information
steven-wan-yu committed Nov 15, 2021
1 parent 0b9d3a6 commit 3518707
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion llvm/tools/llvm-go/llvm-go.go
Expand Up @@ -96,7 +96,11 @@ func llvmFlags() compilerFlags {
// needed to resolve dependent symbols
stdLibOption = "-stdlib=libc++"
}
if runtime.GOOS != "darwin" {
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
Expand Down

0 comments on commit 3518707

Please sign in to comment.