diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -413,7 +413,7 @@ NamedRegionTimer T("discoverStorage", "discover storage", TimerGroupName, TimerGroupDesc, opts::TimeRewrite); - auto ELF64LEFile = dyn_cast(InputFile); + auto ELF64LEFile = cast(InputFile); const ELFFile &Obj = ELF64LEFile->getELFFile(); BC->StartFunctionAddress = Obj.getHeader().e_entry; @@ -4222,11 +4222,7 @@ } void RewriteInstance::patchELFPHDRTable() { - auto ELF64LEFile = dyn_cast(InputFile); - if (!ELF64LEFile) { - errs() << "BOLT-ERROR: only 64-bit LE ELF binaries are supported\n"; - exit(1); - } + auto ELF64LEFile = cast(InputFile); const ELFFile &Obj = ELF64LEFile->getELFFile(); raw_fd_ostream &OS = Out->os(); @@ -4375,11 +4371,7 @@ } void RewriteInstance::rewriteNoteSections() { - auto ELF64LEFile = dyn_cast(InputFile); - if (!ELF64LEFile) { - errs() << "BOLT-ERROR: only 64-bit LE ELF binaries are supported\n"; - exit(1); - } + auto ELF64LEFile = cast(InputFile); const ELFFile &Obj = ELF64LEFile->getELFFile(); raw_fd_ostream &OS = Out->os();