[PATCH] D135528: [lld-macho] Implement -ignore_auto_link
Keith Smiley via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 8 21:55:28 PDT 2022
keith updated this revision to Diff 466339.
keith marked an inline comment as done.
keith added a comment.
Rename var to match option
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135528/new/
https://reviews.llvm.org/D135528
Files:
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/Options.td
lld/test/MachO/lc-linker-option.ll
Index: lld/test/MachO/lc-linker-option.ll
===================================================================
--- lld/test/MachO/lc-linker-option.ll
+++ lld/test/MachO/lc-linker-option.ll
@@ -12,6 +12,9 @@
; FRAME-NEXT: cmdsize
; FRAME-NEXT: name /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
+; RUN: not %lld %t/framework.o -o %t/frame_no_autolink -ignore_auto_link 2>&1 | FileCheck --check-prefix=NO_AUTOLINK %s
+; NO_AUTOLINK: error: undefined symbol: __CFBigNumGetInt128
+
; RUN: llvm-as %t/l.ll -o %t/l.o
;; The dynamic call to _CFBigNumGetInt128 uses dyld_stub_binder,
;; which needs -lSystem from LC_LINKER_OPTION to get resolved.
Index: lld/MachO/Options.td
===================================================================
--- lld/MachO/Options.td
+++ lld/MachO/Options.td
@@ -991,6 +991,9 @@
MetaVarName<"<dyld_env_var>">,
HelpText<"Specifies a LC_DYLD_ENVIRONMENT variable value pair.">,
Group<grp_rare>;
+def ignore_auto_link : Flag<["-"], "ignore_auto_link">,
+ HelpText<"Ignore LC_LINKER_OPTIONs">,
+ Group<grp_rare>;
def grp_deprecated : OptionGroup<"deprecated">, HelpText<"DEPRECATED">;
@@ -1270,10 +1273,6 @@
HelpText<"This option is undocumented in ld64">,
Flags<[HelpHidden]>,
Group<grp_undocumented>;
-def ignore_auto_link : Flag<["-"], "ignore_auto_link">,
- HelpText<"This option is undocumented in ld64">,
- Flags<[HelpHidden]>,
- Group<grp_undocumented>;
def ignore_optimization_hints : Flag<["-"], "ignore_optimization_hints">,
HelpText<"Ignore Linker Optimization Hints">,
Group<grp_undocumented>;
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -463,6 +463,9 @@
// flags. This directly parses the flags instead of using the standard argument
// parser to improve performance.
void macho::parseLCLinkerOption(InputFile *f, unsigned argc, StringRef data) {
+ if (config->ignoreAutoLink)
+ return;
+
SmallVector<StringRef, 4> argv;
size_t offset = 0;
for (unsigned i = 0; i < argc && offset < data.size(); ++i) {
@@ -1539,6 +1542,7 @@
config->forceExactCpuSubtypeMatch =
getenv("LD_DYLIB_CPU_SUBTYPES_MUST_MATCH");
config->objcStubsMode = getObjCStubsMode(args);
+ config->ignoreAutoLink = args.hasArg(OPT_ignore_auto_link);
for (const Arg *arg : args.filtered(OPT_alias)) {
config->aliasedSymbols.push_back(
Index: lld/MachO/Config.h
===================================================================
--- lld/MachO/Config.h
+++ lld/MachO/Config.h
@@ -168,6 +168,7 @@
bool demangle = false;
bool deadStrip = false;
bool errorForArchMismatch = false;
+ bool ignoreAutoLink = false;
PlatformInfo platformInfo;
llvm::Optional<PlatformInfo> secondaryPlatformInfo;
NamespaceKind namespaceKind = NamespaceKind::twolevel;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135528.466339.patch
Type: text/x-patch
Size: 2895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221009/0f6007ab/attachment.bin>
More information about the llvm-commits
mailing list