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

Unified Diff: src/IceELFSection.h

Issue 1017373002: Subzero: Assemble calls to constant addresses. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: move test back Created 5 years, 9 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
« no previous file with comments | « src/IceELFObjectWriter.cpp ('k') | src/IceELFSection.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceELFSection.h
diff --git a/src/IceELFSection.h b/src/IceELFSection.h
index 0bfccca650a78b488bee7ce427e4a1a0a18d83e8..c2ef9bf4d3be82eca5f5a912043137f81a3a49b5 100644
--- a/src/IceELFSection.h
+++ b/src/IceELFSection.h
@@ -163,7 +163,11 @@ class ELFSymbolTableSection : public ELFSection {
ELFSymbolTableSection &operator=(const ELFSymbolTableSection &) = delete;
public:
- using ELFSection::ELFSection;
+ ELFSymbolTableSection(const IceString &Name, Elf64_Word ShType,
+ Elf64_Xword ShFlags, Elf64_Xword ShAddralign,
+ Elf64_Xword ShEntsize)
+ : ELFSection(Name, ShType, ShFlags, ShAddralign, ShEntsize),
+ NullSymbol(nullptr) {}
// Create initial entry for a symbol when it is defined.
// Each entry should only be defined once.
@@ -179,6 +183,9 @@ public:
const ELFSym *findSymbol(const IceString &Name) const;
+ void createNullSymbol(ELFSection *NullSection);
+ const ELFSym *getNullSymbol() const { return NullSymbol; }
+
size_t getSectionDataSize() const {
return (LocalSymbols.size() + GlobalSymbols.size()) * Header.sh_entsize;
}
@@ -198,6 +205,7 @@ private:
template <bool IsELF64>
void writeSymbolMap(ELFStreamer &Str, const SymMap &Map);
+ const ELFSym *NullSymbol;
// Keep Local and Global symbols separate, since the sh_info needs to
// know the index of the last LOCAL.
SymMap LocalSymbols;
@@ -211,7 +219,11 @@ class ELFRelocationSection : public ELFSection {
ELFRelocationSection &operator=(const ELFRelocationSection &) = delete;
public:
- using ELFSection::ELFSection;
+ ELFRelocationSection(const IceString &Name, Elf64_Word ShType,
+ Elf64_Xword ShFlags, Elf64_Xword ShAddralign,
+ Elf64_Xword ShEntsize)
+ : ELFSection(Name, ShType, ShFlags, ShAddralign, ShEntsize),
+ RelatedSection(nullptr) {}
const ELFSection *getRelatedSection() const { return RelatedSection; }
void setRelatedSection(const ELFSection *Section) {
@@ -340,7 +352,11 @@ template <bool IsELF64>
void ELFRelocationSection::writeData(const GlobalContext &Ctx, ELFStreamer &Str,
const ELFSymbolTableSection *SymTab) {
for (const AssemblerFixup &Fixup : Fixups) {
- const ELFSym *Symbol = SymTab->findSymbol(Fixup.symbol(&Ctx));
+ const ELFSym *Symbol;
+ if (Fixup.isNullSymbol())
+ Symbol = SymTab->getNullSymbol();
+ else
+ Symbol = SymTab->findSymbol(Fixup.symbol(&Ctx));
if (!Symbol)
llvm::report_fatal_error("Missing symbol mentioned in reloc");
« no previous file with comments | « src/IceELFObjectWriter.cpp ('k') | src/IceELFSection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698