[lld] b6772e6 - [lld-macho] Don't rewrite -rpath arguments in response file

Jez Ng via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 20:52:53 PST 2022


Author: Jez Ng
Date: 2022-12-15T23:52:42-05:00
New Revision: b6772e6e2045ab491b41d3767f788250800f97ea

URL: https://github.com/llvm/llvm-project/commit/b6772e6e2045ab491b41d3767f788250800f97ea
DIFF: https://github.com/llvm/llvm-project/commit/b6772e6e2045ab491b41d3767f788250800f97ea.diff

LOG: [lld-macho] Don't rewrite -rpath arguments in response file

We only want to rewrite paths to files that the linker looks up. Files
under RPATH are looked up at runtime by dyld.

Reviewed By: #lld-macho, keith

Differential Revision: https://reviews.llvm.org/D140167

Added: 
    

Modified: 
    lld/MachO/DriverUtils.cpp
    lld/test/MachO/reproduce.s

Removed: 
    


################################################################################
diff  --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp
index d1ab17fa8ab0..be03d88f5a72 100644
--- a/lld/MachO/DriverUtils.cpp
+++ b/lld/MachO/DriverUtils.cpp
@@ -159,7 +159,6 @@ std::string macho::createResponseFile(const InputArgList &args) {
     case OPT_bundle_loader:
     case OPT_exported_symbols_list:
     case OPT_order_file:
-    case OPT_rpath:
     case OPT_syslibroot:
     case OPT_unexported_symbols_list:
       os << arg->getSpelling() << " " << quote(rewritePath(arg->getValue()))

diff  --git a/lld/test/MachO/reproduce.s b/lld/test/MachO/reproduce.s
index df438b44ce66..6f2ec680e124 100644
--- a/lld/test/MachO/reproduce.s
+++ b/lld/test/MachO/reproduce.s
@@ -11,6 +11,7 @@
 # RUN:     -exported_symbols_list main.exports \
 # RUN:     -order_file main.order \
 # RUN:     -sectcreate __COMPLETELY __legit sectdata.txt \
+# RUN:     -rpath /usr/lib/swift \
 # RUN:     build1/foo.o -o bar --reproduce repro1.tar
 
 # RUN: tar tf repro1.tar | FileCheck -DPATH='%:t.dir' --check-prefix=LIST %s
@@ -30,6 +31,7 @@
 # RSP1-NEXT: -exported_symbols_list [[BASEDIR:.+]]/main.exports
 # RSP1-NEXT: -order_file [[BASEDIR]]/main.order
 # RSP1-NEXT: -sectcreate __COMPLETELY __legit [[BASEDIR]]/sectdata.txt
+# RSP1-NEXT: -rpath /usr/lib/swift
 # RSP1-NOT:  {{^}}repro1{{[/\\]}}
 # RSP1-NEXT: [[BASEDIR]]/build1/foo.o
 # RSP1-NEXT: -o bar


        


More information about the llvm-commits mailing list