forked from OSchip/llvm-project
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
This commit is contained in:
parent
c62ef12079
commit
c8e56f394a
|
@ -110,6 +110,9 @@ static cl::opt<bool> PreserveAssemblyUseListOrder(
|
||||||
cl::desc("Preserve use-list order when writing LLVM assembly."),
|
cl::desc("Preserve use-list order when writing LLVM assembly."),
|
||||||
cl::init(false), cl::Hidden);
|
cl::init(false), cl::Hidden);
|
||||||
|
|
||||||
|
static cl::opt<bool> NoVerify("disable-verify",
|
||||||
|
cl::desc("Do not run the verifier"), cl::Hidden);
|
||||||
|
|
||||||
static ExitOnError ExitOnErr;
|
static ExitOnError ExitOnErr;
|
||||||
|
|
||||||
// Read the specified bitcode file in and return it. This routine searches the
|
// 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) {
|
||||||
// Load the specified source module.
|
// Load the specified source module.
|
||||||
auto &SrcModule = ModuleLoaderCache(argv0, FileName);
|
auto &SrcModule = ModuleLoaderCache(argv0, FileName);
|
||||||
|
|
||||||
if (verifyModule(SrcModule, &errs())) {
|
if (!NoVerify && verifyModule(SrcModule, &errs())) {
|
||||||
errs() << argv0 << ": " << FileName;
|
errs() << argv0 << ": " << FileName;
|
||||||
WithColor::error() << "input module is broken!\n";
|
WithColor::error() << "input module is broken!\n";
|
||||||
return false;
|
return false;
|
||||||
|
@ -372,7 +375,7 @@ static bool linkFiles(const char *argv0, LLVMContext &Context, Linker &L,
|
||||||
// Note that when ODR merging types cannot verify input files in here When
|
// Note that when ODR merging types cannot verify input files in here When
|
||||||
// doing that debug metadata in the src module might already be pointing to
|
// doing that debug metadata in the src module might already be pointing to
|
||||||
// the destination.
|
// the destination.
|
||||||
if (DisableDITypeMap && verifyModule(*M, &errs())) {
|
if (DisableDITypeMap && !NoVerify && verifyModule(*M, &errs())) {
|
||||||
errs() << argv0 << ": " << File << ": ";
|
errs() << argv0 << ": " << File << ": ";
|
||||||
WithColor::error() << "input module is broken!\n";
|
WithColor::error() << "input module is broken!\n";
|
||||||
return false;
|
return false;
|
||||||
|
@ -471,7 +474,7 @@ int main(int argc, char **argv) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verifyModule(*Composite, &errs())) {
|
if (!NoVerify && verifyModule(*Composite, &errs())) {
|
||||||
errs() << argv[0] << ": ";
|
errs() << argv[0] << ": ";
|
||||||
WithColor::error() << "linked module is broken!\n";
|
WithColor::error() << "linked module is broken!\n";
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue