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

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 16:21:37 PDT 2020


int3 marked an inline comment as done.
int3 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.
----------------
ruiu wrote:
> smeenai wrote:
> > 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?
> I'll second that. To be honest, this "feature" seems to be a minor detail of ld64 that we probably don't want to focus on at the moment. Once we get lld mach-o working and if users start complaining this feature is missing, we can add that, but my bet is that they wouldn't even notice about the absence of this thing.
Okay, I'm removing the check, but the `LLD_FORCE_LOAD_LIBSYSTEM` environment variable still seems useful for unit testing so that we can execute the resulting binaries during local development.


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