[lld-macho] Don't rewrite -rpath arguments in response file
authorJez Ng <jezng@fb.com>
Fri, 16 Dec 2022 04:52:42 +0000 (23:52 -0500)
committerJez Ng <jezng@fb.com>
Fri, 16 Dec 2022 04:52:42 +0000 (23:52 -0500)
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

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

index d1ab17f..be03d88 100644 (file)
@@ -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()))
index df438b4..6f2ec68 100644 (file)
@@ -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