Subzero: Support non-IRT immediate calls with -filetype=iasm. This is done by emitting the following: .byte 0xe8 .long __Sz_AbsoluteZero -4 - . The linker is passed an argument like --defsym=__Sz_AbsoluteZero=0 to force the symbol's value to 0. This special symbol is needed due to an llvm-mc parsing bug. BUG= none R=jvoung@chromium.org Review URL: https://codereview.chromium.org/1027593002
diff --git a/src/IceFixups.cpp b/src/IceFixups.cpp index 05559c5..b6adf84 100644 --- a/src/IceFixups.cpp +++ b/src/IceFixups.cpp
@@ -46,13 +46,15 @@ return Str.str(); } -void AssemblerFixup::emit(GlobalContext *Ctx) const { +void AssemblerFixup::emit(GlobalContext *Ctx, RelocOffsetT BaseOffset) const { + if (!ALLOW_DUMP) + return; Ostream &Str = Ctx->getStrEmit(); - // TODO(jvoung): Not yet clear how to emit a relocation against - // the null symbol. - assert(!isNullSymbol()); - Str << symbol(Ctx); - RelocOffsetT Offset = offset(); + if (isNullSymbol()) + Str << "__Sz_AbsoluteZero"; + else + Str << symbol(Ctx); + RelocOffsetT Offset = offset() + BaseOffset; if (Offset) Str << " + " << Offset; }