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

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: Code review changes 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
« no previous file with comments | « src/IceInstX8632.cpp ('k') | src/IceInstX86Base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceInstX8664.cpp
diff --git a/src/IceInstX8664.cpp b/src/IceInstX8664.cpp
index e7130edc1511371fe0d04ceb57c6a8d4802b6825..593b39f9ae1cd0314ab06b5f6d5290cfb4a1c952 100644
--- a/src/IceInstX8664.cpp
+++ b/src/IceInstX8664.cpp
@@ -66,9 +66,10 @@ void TargetX8664Traits::X86Operand::dump(const Cfg *, Ostream &Str) const {
TargetX8664Traits::X86OperandMem::X86OperandMem(Cfg *Func, Type Ty,
Variable *Base,
Constant *Offset,
- Variable *Index, uint16_t Shift)
+ 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 +134,8 @@ void TargetX8664Traits::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");
}
@@ -242,8 +244,8 @@ TargetX8664Traits::Address TargetX8664Traits::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");
}
« no previous file with comments | « src/IceInstX8632.cpp ('k') | src/IceInstX86Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698