Add command line option to disable ObjC category merging.

This adds the no_objc_category_merging cmdline option which will
be used in an upcoming commit to disable the category optimizer.

It is on by default in ld64 so we match that here.

Test case will come soon with the patch to make use of this option.

llvm-svn: 259439
This commit is contained in:
Pete Cooper 2016-02-01 23:56:23 +00:00
parent c54600dbb1
commit c2bad09cdd
3 changed files with 11 additions and 0 deletions

View File

@ -129,6 +129,8 @@ public:
void setKeepPrivateExterns(bool v) { _keepPrivateExterns = v; }
bool demangleSymbols() const { return _demangle; }
void setDemangleSymbols(bool d) { _demangle = d; }
bool mergeObjCCategories() const { return _mergeObjCCategories; }
void setMergeObjCCategories(bool v) { _mergeObjCCategories = v; }
/// Create file at specified path which will contain a binary encoding
/// of all input and output file paths.
std::error_code createDependencyFile(StringRef path);
@ -427,6 +429,7 @@ private:
bool _testingFileUsage;
bool _keepPrivateExterns;
bool _demangle;
bool _mergeObjCCategories = true;
StringRef _bundleLoader;
mutable std::unique_ptr<mach_o::ArchHandler> _archHandler;
mutable std::unique_ptr<Writer> _writer;

View File

@ -817,6 +817,10 @@ bool DarwinLdDriver::parse(llvm::ArrayRef<const char *> args,
ctx.setUndefinedMode(UndefMode);
}
// Handle -no_objc_category_merging.
if (parsedArgs.getLastArg(OPT_no_objc_category_merging))
ctx.setMergeObjCCategories(false);
// Handle -rpath <path>
if (parsedArgs.hasArg(OPT_rpath)) {
switch (ctx.outputMachOType()) {

View File

@ -68,6 +68,10 @@ def undefined : Separate<["-"], "undefined">,
MetaVarName<"<undefined>">,
HelpText<"Determines how undefined symbols are handled.">,
Group<grp_opts>;
def no_objc_category_merging : Flag<["-"], "no_objc_category_merging">,
HelpText<"Disables the optimisation which merges Objective-C categories "
"on a class in to the class itself.">,
Group<grp_opts>;
// main executable options
def grp_main : OptionGroup<"opts">, HelpText<"MAIN EXECUTABLE OPTIONS">;