Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1978)

Unified Diff: src/IceELFSection.h

Issue 874353006: Write out global initializers and data rel directly to ELF file. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: tweak comment Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/IceELFSection.h
diff --git a/src/IceELFSection.h b/src/IceELFSection.h
index 5821a8382d6caefa7855f5f8d5ef053fe43421fc..db000f4915e8f0f7affb91bc242605d5b67937c4 100644
--- a/src/IceELFSection.h
+++ b/src/IceELFSection.h
@@ -117,6 +117,16 @@ 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);
+
+ // Pad the next section offset for writing data elements to the requested
+ // alignment. If the section is NOBITS then do not actually write out
+ // the padding and only update the section size.
+ void padToAlignment(ELFStreamer &Str, Elf64_Xword Align);
};
// Model of ELF symbol table entries. Besides keeping track of the fields
@@ -195,13 +205,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 +224,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;
};

Powered by Google App Engine
This is Rietveld 408576698