diff options
author | dim <dim@FreeBSD.org> | 2014-11-24 09:08:18 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2014-11-24 09:08:18 +0000 |
commit | e27feadae0885aa074df58ebfda2e7a7f7a7d590 (patch) | |
tree | f5944309621cee4fe0976be6f9ac619b7ebfc4c2 /lib/Target/PowerPC/PPCTargetObjectFile.cpp | |
parent | 87ba4fbed530c9d0dff7505d121035f5ed09c9f3 (diff) | |
download | FreeBSD-src-e27feadae0885aa074df58ebfda2e7a7f7a7d590.zip FreeBSD-src-e27feadae0885aa074df58ebfda2e7a7f7a7d590.tar.gz |
Vendor import of llvm RELEASE_350/final tag r216957 (effectively, 3.5.0 release):
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_350/final@216957
Diffstat (limited to 'lib/Target/PowerPC/PPCTargetObjectFile.cpp')
-rw-r--r-- | lib/Target/PowerPC/PPCTargetObjectFile.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/lib/Target/PowerPC/PPCTargetObjectFile.cpp b/lib/Target/PowerPC/PPCTargetObjectFile.cpp index ec1e606..2903cc1 100644 --- a/lib/Target/PowerPC/PPCTargetObjectFile.cpp +++ b/lib/Target/PowerPC/PPCTargetObjectFile.cpp @@ -8,10 +8,10 @@ //===----------------------------------------------------------------------===// #include "PPCTargetObjectFile.h" +#include "llvm/IR/Mangler.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCSectionELF.h" -#include "llvm/Target/Mangler.h" using namespace llvm; @@ -22,16 +22,9 @@ Initialize(MCContext &Ctx, const TargetMachine &TM) { InitializeELF(TM.Options.UseInitArray); } -const MCSection * PPC64LinuxTargetObjectFile:: -SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, - Mangler *Mang, const TargetMachine &TM) const { - - const MCSection *DefaultSection = - TargetLoweringObjectFileELF::SelectSectionForGlobal(GV, Kind, Mang, TM); - - if (DefaultSection != ReadOnlySection) - return DefaultSection; - +const MCSection *PPC64LinuxTargetObjectFile::SelectSectionForGlobal( + const GlobalValue *GV, SectionKind Kind, Mangler &Mang, + const TargetMachine &TM) const { // Here override ReadOnlySection to DataRelROSection for PPC64 SVR4 ABI // when we have a constant that contains global relocations. This is // necessary because of this ABI's handling of pointers to functions in @@ -46,14 +39,17 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, // linker, so we must use DataRelROSection instead of ReadOnlySection. // For more information, see the description of ELIMINATE_COPY_RELOCS in // GNU ld. - const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV); + if (Kind.isReadOnly()) { + const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV); - if (GVar && GVar->isConstant() && - (GVar->getInitializer()->getRelocationInfo() == - Constant::GlobalRelocations)) - return DataRelROSection; + if (GVar && GVar->isConstant() && + (GVar->getInitializer()->getRelocationInfo() == + Constant::GlobalRelocations)) + Kind = SectionKind::getReadOnlyWithRel(); + } - return DefaultSection; + return TargetLoweringObjectFileELF::SelectSectionForGlobal(GV, Kind, + Mang, TM); } const MCExpr *PPC64LinuxTargetObjectFile:: |