[PATCH] D77087: [lld-macho] Only mock out libSystem.dylib loading in tests
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 02:07:38 PDT 2020
int3 updated this revision to Diff 256945.
int3 added a comment.
use LLD_IN_TEST
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77087/new/
https://reviews.llvm.org/D77087
Files:
lld/MachO/Writer.cpp
Index: lld/MachO/Writer.cpp
===================================================================
--- lld/MachO/Writer.cpp
+++ lld/MachO/Writer.cpp
@@ -351,10 +351,14 @@
}
}
- // TODO: dyld requires libSystem to be loaded. libSystem is a universal
- // binary and we don't have support for that yet, so mock it out here.
- headerSection->addLoadCommand(
- make<LCLoadDylib>("/usr/lib/libSystem.B.dylib"));
+ // dyld requires us to load libSystem. This environment variable is used in
+ // tests, as we may also run those tests on non-OSX systems which do not
+ // have libSystem.
+ if (StringRef(getenv("LLD_IN_TEST")) == "1" &&
+ dylibOrdinal == 1 && config->outputType == MH_EXECUTE) {
+ headerSection->addLoadCommand(
+ make<LCLoadDylib>("/usr/lib/libSystem.B.dylib"));
+ }
}
void Writer::createHiddenSections() {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77087.256945.patch
Type: text/x-patch
Size: 857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200413/490f061c/attachment.bin>
More information about the llvm-commits
mailing list