mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
Introduce the --no-link option
Introduce an option to prevent `revamb` from linking in all the QEMU helpers. This is useful if the output doesn't need to be compiled, but just analyzed.
This commit is contained in:
+10
-7
@@ -73,7 +73,8 @@ CodeGenerator::CodeGenerator(BinaryFile &Binary,
|
||||
std::string BBSummary,
|
||||
bool EnableOSRA,
|
||||
bool EnableTracing,
|
||||
bool DetectFunctionBoundaries) :
|
||||
bool DetectFunctionBoundaries,
|
||||
bool EnableLinking) :
|
||||
TargetArchitecture(Target),
|
||||
Context(getGlobalContext()),
|
||||
TheModule((new Module("top", Context))),
|
||||
@@ -82,7 +83,8 @@ CodeGenerator::CodeGenerator(BinaryFile &Binary,
|
||||
Binary(Binary),
|
||||
EnableOSRA(EnableOSRA),
|
||||
EnableTracing(EnableTracing),
|
||||
DetectFunctionBoundaries(DetectFunctionBoundaries)
|
||||
DetectFunctionBoundaries(DetectFunctionBoundaries),
|
||||
EnableLinking(EnableLinking)
|
||||
{
|
||||
OriginalInstrMDKind = Context.getMDKindID("oi");
|
||||
PTCInstrMDKind = Context.getMDKindID("pi");
|
||||
@@ -875,11 +877,12 @@ void CodeGenerator::translate(uint64_t VirtualAddress,
|
||||
GV.setLinkage(GlobalValue::InternalLinkage);
|
||||
}
|
||||
|
||||
Linker TheLinker(*TheModule);
|
||||
bool Result = TheLinker.linkInModule(std::move(HelpersModule),
|
||||
Linker::LinkOnlyNeeded);
|
||||
assert(!Result && "Linking failed");
|
||||
(void) Result;
|
||||
if (EnableLinking) {
|
||||
Linker TheLinker(*TheModule);
|
||||
bool Result = TheLinker.linkInModule(std::move(HelpersModule),
|
||||
Linker::LinkOnlyNeeded);
|
||||
assert(!Result && "Linking failed");
|
||||
}
|
||||
|
||||
Variables.setDataLayout(&TheModule->getDataLayout());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user