forked from OSchip/llvm-project
parent
5211715360
commit
ae7e4995ca
|
@ -245,14 +245,14 @@ class ELFObjectWriter : public MCObjectWriter {
|
||||||
|
|
||||||
void CompressDebugSections(MCAssembler &Asm, MCAsmLayout &Layout);
|
void CompressDebugSections(MCAssembler &Asm, MCAsmLayout &Layout);
|
||||||
|
|
||||||
void WriteRelocations(MCAssembler &Asm, MCAsmLayout &Layout);
|
void WriteRelocations(MCAssembler &Asm, const MCAsmLayout &Layout);
|
||||||
|
|
||||||
void CreateMetadataSections(MCAssembler &Asm, MCAsmLayout &Layout,
|
void CreateMetadataSections(MCAssembler &Asm, const MCAsmLayout &Layout,
|
||||||
std::vector<const MCSectionELF *> &Sections);
|
std::vector<const MCSectionELF *> &Sections);
|
||||||
|
|
||||||
// Create the sections that show up in the symbol table. Currently
|
// Create the sections that show up in the symbol table. Currently
|
||||||
// those are the .note.GNU-stack section and the group sections.
|
// those are the .note.GNU-stack section and the group sections.
|
||||||
void createIndexedSections(MCAssembler &Asm, MCAsmLayout &Layout,
|
void createIndexedSections(MCAssembler &Asm, const MCAsmLayout &Layout,
|
||||||
RevGroupMapTy &RevGroupMap,
|
RevGroupMapTy &RevGroupMap,
|
||||||
std::vector<const MCSectionELF *> &Sections,
|
std::vector<const MCSectionELF *> &Sections,
|
||||||
SectionIndexMapTy &SectionIndexMap);
|
SectionIndexMapTy &SectionIndexMap);
|
||||||
|
@ -1147,7 +1147,7 @@ void ELFObjectWriter::createRelocationSection(MCAssembler &Asm,
|
||||||
}
|
}
|
||||||
|
|
||||||
static SmallVector<char, 128>
|
static SmallVector<char, 128>
|
||||||
getUncompressedData(MCAsmLayout &Layout,
|
getUncompressedData(const MCAsmLayout &Layout,
|
||||||
MCSectionData::FragmentListType &Fragments) {
|
MCSectionData::FragmentListType &Fragments) {
|
||||||
SmallVector<char, 128> UncompressedData;
|
SmallVector<char, 128> UncompressedData;
|
||||||
for (const MCFragment &F : Fragments) {
|
for (const MCFragment &F : Fragments) {
|
||||||
|
@ -1194,7 +1194,7 @@ prependCompressionHeader(uint64_t Size,
|
||||||
// Return a single fragment containing the compressed contents of the whole
|
// Return a single fragment containing the compressed contents of the whole
|
||||||
// section. Null if the section was not compressed for any reason.
|
// section. Null if the section was not compressed for any reason.
|
||||||
static std::unique_ptr<MCDataFragment>
|
static std::unique_ptr<MCDataFragment>
|
||||||
getCompressedFragment(MCAsmLayout &Layout,
|
getCompressedFragment(const MCAsmLayout &Layout,
|
||||||
MCSectionData::FragmentListType &Fragments) {
|
MCSectionData::FragmentListType &Fragments) {
|
||||||
std::unique_ptr<MCDataFragment> CompressedFragment(new MCDataFragment());
|
std::unique_ptr<MCDataFragment> CompressedFragment(new MCDataFragment());
|
||||||
|
|
||||||
|
@ -1291,7 +1291,8 @@ void ELFObjectWriter::CompressDebugSections(MCAssembler &Asm,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ELFObjectWriter::WriteRelocations(MCAssembler &Asm, MCAsmLayout &Layout) {
|
void ELFObjectWriter::WriteRelocations(MCAssembler &Asm,
|
||||||
|
const MCAsmLayout &Layout) {
|
||||||
for (MCAssembler::iterator it = Asm.begin(), ie = Asm.end(); it != ie; ++it) {
|
for (MCAssembler::iterator it = Asm.begin(), ie = Asm.end(); it != ie; ++it) {
|
||||||
MCSectionData &RelSD = *it;
|
MCSectionData &RelSD = *it;
|
||||||
const MCSectionELF &RelSection =
|
const MCSectionELF &RelSection =
|
||||||
|
@ -1372,7 +1373,7 @@ void ELFObjectWriter::WriteRelocationsFragment(const MCAssembler &Asm,
|
||||||
}
|
}
|
||||||
|
|
||||||
void ELFObjectWriter::CreateMetadataSections(
|
void ELFObjectWriter::CreateMetadataSections(
|
||||||
MCAssembler &Asm, MCAsmLayout &Layout,
|
MCAssembler &Asm, const MCAsmLayout &Layout,
|
||||||
std::vector<const MCSectionELF *> &Sections) {
|
std::vector<const MCSectionELF *> &Sections) {
|
||||||
MCContext &Ctx = Asm.getContext();
|
MCContext &Ctx = Asm.getContext();
|
||||||
MCDataFragment *F;
|
MCDataFragment *F;
|
||||||
|
@ -1424,7 +1425,7 @@ void ELFObjectWriter::CreateMetadataSections(
|
||||||
}
|
}
|
||||||
|
|
||||||
void ELFObjectWriter::createIndexedSections(
|
void ELFObjectWriter::createIndexedSections(
|
||||||
MCAssembler &Asm, MCAsmLayout &Layout, RevGroupMapTy &RevGroupMap,
|
MCAssembler &Asm, const MCAsmLayout &Layout, RevGroupMapTy &RevGroupMap,
|
||||||
std::vector<const MCSectionELF *> &Sections,
|
std::vector<const MCSectionELF *> &Sections,
|
||||||
SectionIndexMapTy &SectionIndexMap) {
|
SectionIndexMapTy &SectionIndexMap) {
|
||||||
MCContext &Ctx = Asm.getContext();
|
MCContext &Ctx = Asm.getContext();
|
||||||
|
@ -1566,16 +1567,14 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
|
||||||
|
|
||||||
CompressDebugSections(Asm, const_cast<MCAsmLayout &>(Layout));
|
CompressDebugSections(Asm, const_cast<MCAsmLayout &>(Layout));
|
||||||
std::vector<const MCSectionELF *> Sections;
|
std::vector<const MCSectionELF *> Sections;
|
||||||
createIndexedSections(Asm, const_cast<MCAsmLayout &>(Layout), RevGroupMap,
|
createIndexedSections(Asm, Layout, RevGroupMap, Sections, SectionIndexMap);
|
||||||
Sections, SectionIndexMap);
|
|
||||||
|
|
||||||
// Compute symbol table information.
|
// Compute symbol table information.
|
||||||
computeSymbolTable(Asm, Layout, SectionIndexMap, RevGroupMap);
|
computeSymbolTable(Asm, Layout, SectionIndexMap, RevGroupMap);
|
||||||
|
|
||||||
WriteRelocations(Asm, const_cast<MCAsmLayout &>(Layout));
|
WriteRelocations(Asm, Layout);
|
||||||
|
|
||||||
CreateMetadataSections(const_cast<MCAssembler &>(Asm),
|
CreateMetadataSections(Asm, Layout, Sections);
|
||||||
const_cast<MCAsmLayout &>(Layout), Sections);
|
|
||||||
|
|
||||||
unsigned NumSections = Asm.size();
|
unsigned NumSections = Asm.size();
|
||||||
SectionOffsetsTy SectionOffsets;
|
SectionOffsetsTy SectionOffsets;
|
||||||
|
|
Loading…
Reference in New Issue