Output a CSV file with the required libraries

This commit makes `revamb` produce a new file `.ll.need.csv` containing
a list of all the dynamic libraries required by the input program. This
will be transformed by the 'csv-to-ld-options` (was:
`li-csv-to-ld-options`) into the appropriate linking options.
This commit is contained in:
Alessandro Di Federico
2018-05-29 08:26:13 +02:00
parent 0bd4204e07
commit aa38255149
8 changed files with 117 additions and 68 deletions
+7 -2
View File
@@ -110,7 +110,7 @@ CodeGenerator::CodeGenerator(BinaryFile &Binary,
if (LinkingInfo.size() == 0)
LinkingInfo = OutputPath + ".li.csv";
std::ofstream LinkingInfoStream(LinkingInfo);
LinkingInfoStream << "name,start,end" << std::endl;
LinkingInfoStream << "name,start,end\n";
auto *Uint8Ty = Type::getInt8Ty(Context);
auto *ElfHeaderHelper = new GlobalVariable(*TheModule,
@@ -187,10 +187,15 @@ CodeGenerator::CodeGenerator(BinaryFile &Binary,
LinkingInfoStream << "." << Name
<< ",0x" << std::hex << Segment.StartVirtualAddress
<< ",0x" << std::hex << Segment.EndVirtualAddress
<< std::endl;
<< "\n";
}
// Write needed libraries CSV
std::string NeededLibs = OutputPath + ".need.csv";
std::ofstream NeededLibsStream(NeededLibs);
for (const std::string &Library : Binary.neededLibraryNames())
NeededLibsStream << Library << "\n";
}
Function *CodeGenerator::importHelperFunctionDefinition(StringRef Name) {