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

Unified Diff: src/IceInstX8664.cpp

Issue 1506653002: Subzero: Add Non-SFI support for x86-32. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Refactor the link commands Created 4 years, 12 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/IceInstX8664.cpp
diff --git a/src/IceInstX8664.cpp b/src/IceInstX8664.cpp
index c682d9e26508f87b72e3147929952466665d09a9..b4199125d4159c112013d5aa46ac64ea9814fc34 100644
--- a/src/IceInstX8664.cpp
+++ b/src/IceInstX8664.cpp
@@ -64,13 +64,11 @@ void MachineTraits<TargetX8664>::X86Operand::dump(const Cfg *,
Str << "<OperandX8664>";
}
-MachineTraits<TargetX8664>::X86OperandMem::X86OperandMem(Cfg *Func, Type Ty,
- Variable *Base,
- Constant *Offset,
- Variable *Index,
- uint16_t Shift)
+MachineTraits<TargetX8664>::X86OperandMem::X86OperandMem(
+ Cfg *Func, Type Ty, Variable *Base, Constant *Offset, Variable *Index,
+ uint16_t Shift, bool IsPIC)
: X86Operand(kMem, Ty), Base(Base), Offset(Offset), Index(Index),
- Shift(Shift) {
+ Shift(Shift), IsPIC(IsPIC) {
assert(Shift <= 3);
Vars = nullptr;
NumVars = 0;
@@ -133,7 +131,8 @@ void MachineTraits<TargetX8664>::X86OperandMem::emit(const Cfg *Func) const {
// TODO(sehr): ConstantRelocatable still needs updating for
// rematerializable base/index and Disp.
assert(Disp == 0);
- CR->emitWithoutPrefix(Func->getTarget());
+ const bool UseNonsfi = Func->getContext()->getFlags().getUseNonsfi();
+ CR->emitWithoutPrefix(Func->getTarget(), UseNonsfi ? "@GOTOFF" : "");
} else {
llvm_unreachable("Invalid offset type for x86 mem operand");
}
@@ -241,8 +240,8 @@ MachineTraits<TargetX8664>::X86OperandMem::toAsmAddress(
Disp += static_cast<int32_t>(CI->getValue());
} else if (const auto CR =
llvm::dyn_cast<ConstantRelocatable>(getOffset())) {
- Disp += CR->getOffset();
- Fixup = Asm->createFixup(RelFixup, CR);
+ Disp = CR->getOffset();
+ Fixup = Asm->createFixup(FK_Abs, CR);
} else {
llvm_unreachable("Unexpected offset type");
}

Powered by Google App Engine
This is Rietveld 408576698