Skip to content

Commit 86fc897

Browse files
authored
[lld][MachO] Add --disable_verify flag (#132105)
The `--disable_verify` flag is implemented for ELF and is used to disable LLVM module verification. https://github.com/llvm/llvm-project/blob/93afd8f9ac69d08bd743ef668c59403362c05d7a/lld/ELF/Options.td#L661 This allows us to quickly suppress verification errors.
1 parent 6cc9180 commit 86fc897

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

lld/MachO/Config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ struct Configuration {
219219
llvm::StringRef csProfilePath;
220220
bool pgoWarnMismatch;
221221
bool warnThinArchiveMissingMembers;
222+
bool disableVerify;
222223

223224
bool callGraphProfileSort = false;
224225
llvm::StringRef printSymbolOrder;

lld/MachO/Driver.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,7 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
18321832
args.hasFlag(OPT_warn_thin_archive_missing_members,
18331833
OPT_no_warn_thin_archive_missing_members, true);
18341834
config->generateUuid = !args.hasArg(OPT_no_uuid);
1835+
config->disableVerify = args.hasArg(OPT_disable_verify);
18351836

18361837
auto IncompatWithCGSort = [&](StringRef firstArgStr) {
18371838
// Throw an error only if --call-graph-profile-sort is explicitly specified

lld/MachO/LTO.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ static lto::Config createConfig() {
6060
c.CSIRProfile = std::string(config->csProfilePath);
6161
c.RunCSIRInstr = config->csProfileGenerate;
6262
c.PGOWarnMismatch = config->pgoWarnMismatch;
63+
c.DisableVerify = config->disableVerify;
6364
c.OptLevel = config->ltoo;
6465
c.CGOptLevel = config->ltoCgo;
6566
if (config->saveTemps)

lld/MachO/Options.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ def lto_CGO: Joined<["--"], "lto-CGO">,
100100
HelpText<"Set codegen optimization level for LTO (default: 2)">,
101101
MetaVarName<"<cgopt-level>">,
102102
Group<grp_lld>;
103+
def disable_verify : Flag<["--"], "disable_verify">,
104+
HelpText<"Do not verify LLVM modules during LTO">,
105+
Group<grp_lld>;
103106
def thinlto_cache_policy_eq: Joined<["--"], "thinlto-cache-policy=">,
104107
HelpText<"Pruning policy for the ThinLTO cache">,
105108
Group<grp_lld>;

lld/test/MachO/verify.ll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
; REQUIRES: x86
2+
3+
; RUN: llvm-as %s -o %t.o
4+
; RUN: %lld -dylib %t.o -o %t2 --lto-debug-pass-manager 2>&1 | FileCheck %s --check-prefix=VERIFY
5+
; RUN: %lld -dylib %t.o -o %t2 --lto-debug-pass-manager --disable_verify 2>&1 | FileCheck %s --implicit-check-not=VerifierPass
6+
7+
target triple = "x86_64-apple-darwin"
8+
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
9+
10+
define void @_start() {
11+
entry:
12+
ret void
13+
}
14+
15+
; VERIFY: Running pass: VerifierPass
16+
; VERIFY: Running pass: VerifierPass

0 commit comments

Comments
 (0)