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

Unified Diff: src/IceELFSection.cpp

Issue 1773503003: Subzero: Control memory growth from local label fixups. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Attempt to fix -nonsfi -filetype=iasm -target=arm32 Created 4 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/IceELFSection.h ('k') | src/IceFixups.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceELFSection.cpp
diff --git a/src/IceELFSection.cpp b/src/IceELFSection.cpp
index cf5c733c4bbddc411c983bb2d066315f1b517c2a..89c7369f5e9ef85c1ca350e4b8571b3b37cb9a5a 100644
--- a/src/IceELFSection.cpp
+++ b/src/IceELFSection.cpp
@@ -67,11 +67,24 @@ void ELFDataSection::padToAlignment(ELFStreamer &Str, Elf64_Xword Align) {
// Relocation sections.
void ELFRelocationSection::addRelocations(RelocOffsetT BaseOff,
- const FixupRefList &FixupRefs) {
+ const FixupRefList &FixupRefs,
+ ELFSymbolTableSection *SymTab) {
for (const AssemblerFixup *FR : FixupRefs) {
Fixups.push_back(*FR);
AssemblerFixup &F = Fixups.back();
F.set_position(BaseOff + F.position());
+ assert(!F.valueIsSymbol());
+ if (!F.isNullSymbol()) {
+ // Do an early lookup in the symbol table. If the symbol is found,
+ // replace the Constant in the symbol with the ELFSym, and calculate the
+ // final value of the addend. As such, a local label allocated from the
+ // Assembler arena will be converted to a symbol before the Assembler
+ // arena goes away.
+ if (const ELFSym *Sym = SymTab->findSymbol(F.symbol())) {
+ F.set_addend(F.offset());
+ F.set_value(Sym);
+ }
+ }
}
}
« no previous file with comments | « src/IceELFSection.h ('k') | src/IceFixups.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698