diff options
Diffstat (limited to 'lib/Target/Mips/MipsTargetObjectFile.cpp')
-rw-r--r-- | lib/Target/Mips/MipsTargetObjectFile.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/Target/Mips/MipsTargetObjectFile.cpp b/lib/Target/Mips/MipsTargetObjectFile.cpp index 4c748c5b57..90afe9b298 100644 --- a/lib/Target/Mips/MipsTargetObjectFile.cpp +++ b/lib/Target/Mips/MipsTargetObjectFile.cpp @@ -52,6 +52,24 @@ void MipsTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){ ELF::SHT_MIPS_REGINFO, ELF::SHF_ALLOC, SectionKind::getMetadata()); + + // @LOCALMOD-BEGIN + // Without this the linker defined symbols __fini_array_start and + // __fini_array_end do not have useful values. c.f.: + // http://code.google.com/p/nativeclient/issues/detail?id=805 + if (Subtarget.isTargetNaCl()) { + StaticCtorSection = + getContext().getELFSection(".init_array", ELF::SHT_INIT_ARRAY, + ELF::SHF_WRITE | + ELF::SHF_ALLOC, + SectionKind::getDataRel()); + StaticDtorSection = + getContext().getELFSection(".fini_array", ELF::SHT_FINI_ARRAY, + ELF::SHF_WRITE | + ELF::SHF_ALLOC, + SectionKind::getDataRel()); + } + // @LOCALMOD-END } // A address must be loaded from a small section if its size is less than the @@ -81,6 +99,12 @@ IsGlobalInSmallSection(const GlobalValue *GV, const TargetMachine &TM, if (!Subtarget.useSmallSection()) return false; + // @LOCALMOD-BEGIN + // Do not use small section for NaCl. + if (Subtarget.isTargetNaCl()) + return false; + // @LOCALMOD-BEGIN + // Only global variables, not functions. const GlobalVariable *GVA = dyn_cast<GlobalVariable>(GV); if (!GVA) |