[PATCH] D113704: [AIX][llvm-go] AIX linker does not recognize `-rpath`

Steven Wan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 15 09:56:35 PST 2021


stevewan updated this revision to Diff 387305.
stevewan added a comment.

Flatten nested if


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113704/new/

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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113704.387305.patch
Type: text/x-patch
Size: 1010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211115/ce545bd2/attachment.bin>


More information about the llvm-commits mailing list