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

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 22:07:35 PDT 2020


smeenai added inline comments.


================
Comment at: lld/test/MachO/no-libsystem.s:8-10
+## Even though we are not loading libSystem here -- just a random dylib -- the
+## error doesn't show up. This mimics ld64's behavior, which only cares that
+## *some* dylib is loaded.
----------------
Hah, that seems pretty broken. dyld seems to be happy enough to load an executable that's not linking to libSystem either, though I haven't tested that on Catalina yet.

In this case, I'm not sure how much value this check (or the force link against libSystem) adds, tbh. The vast majority of people will be invoking the linker via the clang driver, which will add libSystem automatically. For the few people invoking the linker directly, if they reference libSystem functions and forget to link it, they'll get pretty obvious undefined symbol errors. This error wouldn't fire as long as they were linking any other dylib anyway, so it doesn't seem to add much value. What do you think?


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