[PATCH] D95913: [lld-macho] Implement -bundle_loader

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 10 11:22:20 PST 2021


jyknight added inline comments.


================
Comment at: lld/MachO/SyntheticSections.cpp:272
                                  dysym->file->ordinal);
-    } else {
+    } else if (!dysym->file->isBundleLoader) {
+      // bundle-loader "dylib" is special because its ordinal is
----------------
I think this needs to emit BIND_OPCODE_SET_DYLIB_SPECIAL_IMM when ordinal < 0, instead of checking isBundleLoader and not outputting any command.

I guess the default is executable, perhaps? So the test works if it's the first symbol, but if there was a symbol refering to another lib first, then this would incorrectly remain pointing to that other library since no command is emitted.


================
Comment at: lld/MachO/SyntheticSections.cpp:791
       uint16_t n_desc = nList->n_desc;
       MachO::SET_LIBRARY_ORDINAL(n_desc, dysym->file->ordinal);
       nList->n_type = MachO::N_EXT;
----------------
Probably should explicitly convert back to EXECUTABLE_ORDINAL here -- it's working anyways because BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE is -1, which converts to 0xff, but that seems kinda sketchy.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95913



More information about the llvm-commits mailing list