Skip to content

Commit 354fa1f

Browse files
nlewyckymemfrob
authored andcommitted
Add -disable-verify flag to llvm-link.
This flag allows the developer to see the result of linking even if it fails the verifier, as a step in debugging cases where the linked module fails the verifier. Differential Revision: https://reviews.llvm.org/D99382
1 parent d6db9ad commit 354fa1f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

llvm/tools/llvm-link/llvm-link.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ static cl::opt<bool> PreserveAssemblyUseListOrder(
110110
cl::desc("Preserve use-list order when writing LLVM assembly."),
111111
cl::init(false), cl::Hidden);
112112

113+
static cl::opt<bool> NoVerify("disable-verify",
114+
cl::desc("Do not run the verifier"), cl::Hidden);
115+
113116
static ExitOnError ExitOnErr;
114117

115118
// Read the specified bitcode file in and return it. This routine searches the
@@ -311,7 +314,7 @@ static bool importFunctions(const char *argv0, Module &DestModule) {
311314
// Load the specified source module.
312315
auto &SrcModule = ModuleLoaderCache(argv0, FileName);
313316

314-
if (verifyModule(SrcModule, &errs())) {
317+
if (!NoVerify && verifyModule(SrcModule, &errs())) {
315318
errs() << argv0 << ": " << FileName;
316319
WithColor::error() << "input module is broken!\n";
317320
return false;
@@ -372,7 +375,7 @@ static bool linkFiles(const char *argv0, LLVMContext &Context, Linker &L,
372375
// Note that when ODR merging types cannot verify input files in here When
373376
// doing that debug metadata in the src module might already be pointing to
374377
// the destination.
375-
if (DisableDITypeMap && verifyModule(*M, &errs())) {
378+
if (DisableDITypeMap && !NoVerify && verifyModule(*M, &errs())) {
376379
errs() << argv0 << ": " << File << ": ";
377380
WithColor::error() << "input module is broken!\n";
378381
return false;
@@ -471,7 +474,7 @@ int main(int argc, char **argv) {
471474
return 1;
472475
}
473476

474-
if (verifyModule(*Composite, &errs())) {
477+
if (!NoVerify && verifyModule(*Composite, &errs())) {
475478
errs() << argv[0] << ": ";
476479
WithColor::error() << "linked module is broken!\n";
477480
return 1;

0 commit comments

Comments
 (0)