[PATCH] D86640: [lld-macho] Implement -all_load
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 09:57:09 PDT 2020
int3 created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
int3 requested review of this revision.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D86640
Files:
lld/MachO/Config.h
lld/MachO/Driver.cpp
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -248,7 +248,12 @@
if (!file->isEmpty() && !file->hasSymbolTable())
error(path + ": archive has no index; run ranlib to add one");
- if (config->forceLoadObjC) {
+ if (config->allLoad) {
+ if (Optional<MemoryBufferRef> buffer = readFile(path))
+ for (MemoryBufferRef member : getArchiveMembers(*buffer))
+ inputFiles.push_back(make<ObjFile>(member));
+
+ } else if (config->forceLoadObjC) {
for (const object::Archive::Symbol &sym : file->symbols())
if (sym.getName().startswith(objc::klass))
symtab->addUndefined(sym.getName());
@@ -517,6 +522,7 @@
config->headerPad = args::getHex(args, OPT_headerpad, /*Default=*/32);
config->outputType = args.hasArg(OPT_dylib) ? MH_DYLIB : MH_EXECUTE;
config->runtimePaths = args::getStrings(args, OPT_rpath);
+ config->allLoad = args.hasArg(OPT_all_load);
std::vector<StringRef> &roots = config->systemLibraryRoots;
for (const Arg *arg : args.filtered(OPT_syslibroot))
@@ -581,6 +587,7 @@
case OPT_platform_version:
handlePlatformVersion(arg);
break;
+ case OPT_all_load:
case OPT_o:
case OPT_dylib:
case OPT_e:
Index: lld/MachO/Config.h
===================================================================
--- lld/MachO/Config.h
+++ lld/MachO/Config.h
@@ -33,6 +33,7 @@
struct Configuration {
Symbol *entry;
bool hasReexports = false;
+ bool allLoad = false;
bool forceLoadObjC = false;
uint32_t headerPad;
llvm::StringRef installName;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86640.288019.patch
Type: text/x-patch
Size: 1666 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200826/84abb626/attachment.bin>
More information about the llvm-commits
mailing list