Skip to content

[lld][MachO] Add --disable_verify flag #132105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lld/MachO/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ struct Configuration {
llvm::StringRef csProfilePath;
bool pgoWarnMismatch;
bool warnThinArchiveMissingMembers;
bool disableVerify;

bool callGraphProfileSort = false;
llvm::StringRef printSymbolOrder;
Expand Down
1 change: 1 addition & 0 deletions lld/MachO/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,7 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
args.hasFlag(OPT_warn_thin_archive_missing_members,
OPT_no_warn_thin_archive_missing_members, true);
config->generateUuid = !args.hasArg(OPT_no_uuid);
config->disableVerify = args.hasArg(OPT_disable_verify);

auto IncompatWithCGSort = [&](StringRef firstArgStr) {
// Throw an error only if --call-graph-profile-sort is explicitly specified
Expand Down
1 change: 1 addition & 0 deletions lld/MachO/LTO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static lto::Config createConfig() {
c.CSIRProfile = std::string(config->csProfilePath);
c.RunCSIRInstr = config->csProfileGenerate;
c.PGOWarnMismatch = config->pgoWarnMismatch;
c.DisableVerify = config->disableVerify;
c.OptLevel = config->ltoo;
c.CGOptLevel = config->ltoCgo;
if (config->saveTemps)
Expand Down
3 changes: 3 additions & 0 deletions lld/MachO/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ def lto_CGO: Joined<["--"], "lto-CGO">,
HelpText<"Set codegen optimization level for LTO (default: 2)">,
MetaVarName<"<cgopt-level>">,
Group<grp_lld>;
def disable_verify : Flag<["--"], "disable_verify">,
HelpText<"Do not verify LLVM modules during LTO">,
Group<grp_lld>;
def thinlto_cache_policy_eq: Joined<["--"], "thinlto-cache-policy=">,
HelpText<"Pruning policy for the ThinLTO cache">,
Group<grp_lld>;
Expand Down
16 changes: 16 additions & 0 deletions lld/test/MachO/verify.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
; REQUIRES: x86

; RUN: llvm-as %s -o %t.o
; RUN: %lld -dylib %t.o -o %t2 --lto-debug-pass-manager 2>&1 | FileCheck %s --check-prefix=VERIFY
; RUN: %lld -dylib %t.o -o %t2 --lto-debug-pass-manager --disable_verify 2>&1 | FileCheck %s --implicit-check-not=VerifierPass

target triple = "x86_64-apple-darwin"
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

define void @_start() {
entry:
ret void
}

; VERIFY: Running pass: VerifierPass
; VERIFY: Running pass: VerifierPass
Loading