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

Unified Diff: src/IceFixups.cpp

Issue 1418523002: Add hybrid assembler concept to ARM assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 5 years, 2 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/IceFixups.h ('k') | src/IceGlobalContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceFixups.cpp
diff --git a/src/IceFixups.cpp b/src/IceFixups.cpp
index 6f50f85c61aa0ad3c7b0f78a782896d276b0664e..7b2025ec178467a4814bbb204faf2485a5e40774 100644
--- a/src/IceFixups.cpp
+++ b/src/IceFixups.cpp
@@ -48,11 +48,13 @@ IceString AssemblerFixup::symbol(const GlobalContext *Ctx) const {
return Str.str();
}
-void AssemblerFixup::emit(GlobalContext *Ctx,
- RelocOffsetT OverrideOffset) const {
+size_t AssemblerFixup::emit(GlobalContext *Ctx, RelocOffsetT OverrideOffset,
+ bool IsPCRel) const {
+ static constexpr const size_t FixupSize = 4;
if (!BuildDefs::dump())
- return;
+ return FixupSize;
Ostream &Str = Ctx->getStrEmit();
+ Str << "\t.long ";
if (isNullSymbol())
Str << "__Sz_AbsoluteZero";
else
@@ -60,6 +62,22 @@ void AssemblerFixup::emit(GlobalContext *Ctx,
RelocOffsetT Offset = OverrideOffset;
if (Offset)
Str << " + " << Offset;
+ // For PCRel fixups, we write the pc-offset from a symbol into the Buffer
+ // (e.g., -4), but we don't represent that in the fixup's offset. Otherwise
+ // the fixup holds the true offset, and so does the Buffer. Just load the
+ // offset from the buffer.
+ if (IsPCRel)
+ Str << " - .";
+ Str << "\n";
+ return FixupSize;
+}
+
+size_t AssemblerTextFixup::emit(GlobalContext *Ctx, RelocOffsetT OverrideOffset,
+ bool IsPCRel) const {
+ (void)OverrideOffset;
+ (void)IsPCRel;
+ Ctx->getStrEmit() << Message << "\n";
+ return NumBytes;
}
} // end of namespace Ice
« no previous file with comments | « src/IceFixups.h ('k') | src/IceGlobalContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698