[PATCH] D100147: [lld-macho] Re-root absolute input file paths if -syslibroot is specified

Greg McGary via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 9 16:03:16 PDT 2021


gkm added inline comments.


================
Comment at: lld/MachO/Driver.cpp:80
+// Search for all possible combinations of `{root}/{name}.{extension}`.
+// If \p extensions are not specified, then just search for `{root}/{name}`.
+static Optional<StringRef>
----------------
What does `\p` mean here in this comment?


================
Comment at: lld/test/MachO/reroot-path.s:26-27
+## Test our various file-loading flags to make sure all bases are covered.
+# RUN: %lld -lSystem -syslibroot %t %t/foo.a %t/%:t/bar.a %t/test.o -o /dev/null
+# RUN: %lld -lSystem -syslibroot %t -force_load %t/foo.a -force_load %t/%:t/bar.a %t/test.o -o /dev/null
+# RUN: %lld -lSystem -syslibroot %t %t/libfoo.dylib %t/%:t/libbar.dylib %t/test.o -o /dev/null
----------------
These don't test what you want, since they succeed even without `-syslibroot`:
* PASS without `-syslibroot %t`, since `%t/%:t/bar.a` is a real path, so the syslibroot is unused
* PASS with `-syslibroot %t` and s/`%t/%:t/bar.a`/`%t/bar.a`/ for a syslibroot-relative path
* FAIL (as expected) without `-syslibroot %t` and s/`%t/%:t/bar.a`/`%t/bar.a`/, since syslibroot is needed to reach the syslibroot-relative path


================
Comment at: lld/test/MachO/reroot-path.s:28-29
+# RUN: %lld -lSystem -syslibroot %t -force_load %t/foo.a -force_load %t/%:t/bar.a %t/test.o -o /dev/null
+# RUN: %lld -lSystem -syslibroot %t %t/libfoo.dylib %t/%:t/libbar.dylib %t/test.o -o /dev/null
+# RUN: %lld -lSystem -syslibroot %t -weak_library %t/libfoo.dylib -weak_library %t/%:t/libbar.dylib %t/test.o -o /dev/null
+# RUN: echo "%t/libfoo.dylib" > %t/filelist
----------------
Same behavior here for `libbar.dylib` vs. `bar.a`


================
Comment at: lld/test/MachO/reroot-path.s:30-32
+# RUN: echo "%t/libfoo.dylib" > %t/filelist
+# RUN: echo "%t/%:t/libbar.dylib" >> %t/filelist
+# RUN: %lld -lSystem -syslibroot %t -filelist %t/filelist %t/test.o -o /dev/null
----------------
Same


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100147



More information about the llvm-commits mailing list