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

Unified Diff: src/IceTargetLowering.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: Fill in part of the lit test Created 5 years 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/IceTargetLowering.cpp
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
index dcbb8802924eb948b04a64e69a9877f910e54462..50d8b7e6cb7188961801f1635e5809f485b58c8a 100644
--- a/src/IceTargetLowering.cpp
+++ b/src/IceTargetLowering.cpp
@@ -106,7 +106,8 @@ TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) {
return nullptr;
}
-void TargetLowering::staticInit(TargetArch Target) {
+void TargetLowering::staticInit(const ClFlags &Flags) {
+ const TargetArch Target = Flags.getTargetArch();
// Call the specified target's static initializer.
switch (Target) {
default:
@@ -118,7 +119,7 @@ void TargetLowering::staticInit(TargetArch Target) {
if (InitGuard##X) \
return; \
InitGuard##X = true; \
- Target##X::staticInit(); \
+ Target##X::staticInit(Flags); \
} break;
#include "llvm/Config/SZTargets.def"
}
@@ -512,7 +513,8 @@ bool TargetLowering::shouldOptimizeMemIntrins() {
Ctx->getFlags().getForceMemIntrinOpt();
}
-void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C) const {
+void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C,
+ const char *Suffix) const {
if (!BuildDefs::dump())
return;
Ostream &Str = Ctx->getStrEmit();
@@ -520,6 +522,7 @@ void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C) const {
Str << C->getName();
else
Str << Ctx->mangleName(C->getName());
+ Str << Suffix;
RelocOffsetT Offset = C->getOffset();
if (Offset) {
if (Offset > 0)
@@ -528,14 +531,6 @@ void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C) const {
}
}
-void TargetLowering::emit(const ConstantRelocatable *C) const {
- if (!BuildDefs::dump())
- return;
- Ostream &Str = Ctx->getStrEmit();
- Str << getConstantPrefix();
- emitWithoutPrefix(C);
-}
-
std::unique_ptr<TargetDataLowering>
TargetDataLowering::createLowering(GlobalContext *Ctx) {
TargetArch Target = Ctx->getFlags().getTargetArch();
@@ -593,9 +588,12 @@ void TargetDataLowering::emitGlobal(const VariableDeclaration &Var,
Str << "\t.type\t" << MangledName << ",%object\n";
const bool UseDataSections = Ctx->getFlags().getDataSections();
+ const bool UseNonsfi = Ctx->getFlags().getUseNonsfi();
const IceString Suffix =
dataSectionSuffix(SectionSuffix, MangledName, UseDataSections);
- if (IsConstant)
+ if (IsConstant && UseNonsfi)
+ Str << "\t.section\t.data.rel.ro" << Suffix << ",\"aw\",%progbits\n";
+ else if (IsConstant)
Str << "\t.section\t.rodata" << Suffix << ",\"a\",%progbits\n";
else if (HasNonzeroInitializer)
Str << "\t.section\t.data" << Suffix << ",\"aw\",%progbits\n";

Powered by Google App Engine
This is Rietveld 408576698