| 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";
|
|
|