Skip to content

Instantly share code, notes, and snippets.

@LemonBoy
Created May 28, 2019 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LemonBoy/e676bab499ab9e98de195f5fceba0ef0 to your computer and use it in GitHub Desktop.
Save LemonBoy/e676bab499ab9e98de195f5fceba0ef0 to your computer and use it in GitHub Desktop.
diff --git a/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp b/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
index e93ca86c..4f1e264f 100644
--- a/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
+++ b/deps/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
@@ -1630,6 +1630,14 @@ normalizedFromAtoms(const lld::File &atomFile,
normFile.pageSize = context.pageSize();
normFile.rpaths = context.rpaths();
util.addDependentDylibs(atomFile, normFile);
+
+ if (context.outputMachOType() == MH_DYLIB) {
+ // If we're not re-exporting any dylib set the MH_NO_REEXPORTED_DYLIBS flag
+ size_t numExportedDylibs = normFile.dependentDylibs.size();
+ if (numExportedDylibs == 0)
+ normFile.flags = normFile.flags | MH_NO_REEXPORTED_DYLIBS;
+ }
+
util.copySegmentInfo(normFile);
util.copySectionInfo(normFile);
util.assignAddressesToSections(normFile);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment