Index: src/IceELFSection.h |
diff --git a/src/IceELFSection.h b/src/IceELFSection.h |
index 5821a8382d6caefa7855f5f8d5ef053fe43421fc..f2e384dffec0de1bc40eed62576b6dcdc8e556be 100644 |
--- a/src/IceELFSection.h |
+++ b/src/IceELFSection.h |
@@ -64,6 +64,10 @@ public: |
void setSize(Elf64_Xword sh_size) { Header.sh_size = sh_size; } |
SizeT getCurrentSize() const { return Header.sh_size; } |
+ void setAlignment(Elf64_Xword sh_addralign) { |
+ Header.sh_addralign = sh_addralign; |
+ } |
+ |
void setNameStrIndex(Elf64_Word sh_name) { Header.sh_name = sh_name; } |
IceString getName() const { return Name; } |
@@ -79,6 +83,8 @@ public: |
// Write the section header out with the given streamer. |
template <bool IsELF64> void writeHeader(ELFStreamer &Str); |
+ void padToAlignment(ELFStreamer &Str, bool WritePadding, Elf64_Xword Align); |
+ |
protected: |
~ELFSection() {} |
@@ -117,6 +123,11 @@ public: |
using ELFSection::ELFSection; |
void appendData(ELFStreamer &Str, const llvm::StringRef MoreData); |
+ |
+ void appendZeros(ELFStreamer &Str, SizeT NumBytes); |
+ |
+ void appendRelocationOffset(ELFStreamer &Str, bool IsRela, |
+ RelocOffsetT RelocOffset); |
}; |
// Model of ELF symbol table entries. Besides keeping track of the fields |
@@ -195,13 +206,18 @@ class ELFRelocationSection : public ELFSection { |
public: |
using ELFSection::ELFSection; |
- ELFSection *getRelatedSection() const { return RelatedSection; } |
- void setRelatedSection(ELFSection *Section) { RelatedSection = Section; } |
+ const ELFSection *getRelatedSection() const { return RelatedSection; } |
+ void setRelatedSection(const ELFSection *Section) { |
+ RelatedSection = Section; |
+ } |
// Track additional relocations which start out relative to offset 0, |
// but should be adjusted to be relative to BaseOff. |
void addRelocations(RelocOffsetT BaseOff, const FixupRefList &FixupRefs); |
+ // Track a single additional relocation. |
+ void addRelocation(const AssemblerFixup &Fixup) { Fixups.push_back(Fixup); } |
+ |
size_t getSectionDataSize(const GlobalContext &Ctx, |
const ELFSymbolTableSection *SymTab) const; |
@@ -209,8 +225,10 @@ public: |
void writeData(const GlobalContext &Ctx, ELFStreamer &Str, |
const ELFSymbolTableSection *SymTab); |
+ bool isRela() const { return Header.sh_type == SHT_RELA; } |
+ |
private: |
- ELFSection *RelatedSection; |
+ const ELFSection *RelatedSection; |
FixupList Fixups; |
}; |