[PATCH] D77087: [lld-macho] Require executables to link against libSystem.dylib

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 30 13:37:28 PDT 2020


int3 marked 2 inline comments as done.
int3 added inline comments.


================
Comment at: lld/MachO/Writer.cpp:351
 
-  // 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"));
+  if (dylibOrdinal == 1 && config->outputType == MH_EXECUTE) {
+    // Used in tests, as we also run those tests on non-OSX systems.
----------------
Instead of checking for MH_EXECUTABLE, ld64 calls a function called `needsEntryPointLoadCommand()`. Not sure what else that encompasses


================
Comment at: lld/test/MachO/lit.local.cfg:1
+config.environment['LLD_FORCE_LOAD_LIBSYSTEM'] = '1'
 config.substitutions += [
----------------
I debated between using a flag and an environment variable, but since we already have the `LLD_IN_TEST` env var, another one seemed appropriate


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77087





More information about the llvm-commits mailing list