[PATCH] D113704: [AIX][llvm-go] AIX linker does not recognize `-rpath`
Steven Wan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 11 11:43:12 PST 2021
stevewan created this revision.
stevewan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D113704
Files:
llvm/tools/llvm-go/llvm-go.go
Index: llvm/tools/llvm-go/llvm-go.go
===================================================================
--- llvm/tools/llvm-go/llvm-go.go
+++ 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"),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113704.386614.patch
Type: text/x-patch
Size: 932 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211111/a50b3bb8/attachment.bin>
More information about the llvm-commits
mailing list