diff options
Diffstat (limited to 'lib/Target/Hexagon/HexagonTargetObjectFile.cpp')
| -rw-r--r-- | lib/Target/Hexagon/HexagonTargetObjectFile.cpp | 15 | 
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Target/Hexagon/HexagonTargetObjectFile.cpp b/lib/Target/Hexagon/HexagonTargetObjectFile.cpp index e771f383dffa..2185bf8eebc6 100644 --- a/lib/Target/Hexagon/HexagonTargetObjectFile.cpp +++ b/lib/Target/Hexagon/HexagonTargetObjectFile.cpp @@ -199,6 +199,10 @@ MCSection *HexagonTargetObjectFile::getExplicitSectionGlobal(  /// section.  bool HexagonTargetObjectFile::isGlobalInSmallSection(const GlobalObject *GO,        const TargetMachine &TM) const { +  bool HaveSData = isSmallDataEnabled(TM); +  if (!HaveSData) +    LLVM_DEBUG(dbgs() << "Small-data allocation is disabled, but symbols " +                         "may have explicit section assignments...\n");    // Only global variables, not functions.    LLVM_DEBUG(dbgs() << "Checking if value is in small-data, -G"                      << SmallDataThreshold << ": \"" << GO->getName() << "\": "); @@ -218,6 +222,12 @@ bool HexagonTargetObjectFile::isGlobalInSmallSection(const GlobalObject *GO,      return IsSmall;    } +  // If sdata is disabled, stop the checks here. +  if (!HaveSData) { +    LLVM_DEBUG(dbgs() << "no, small-data allocation is disabled\n"); +    return false; +  } +    if (GVar->isConstant()) {      LLVM_DEBUG(dbgs() << "no, is a constant\n");      return false; @@ -263,8 +273,9 @@ bool HexagonTargetObjectFile::isGlobalInSmallSection(const GlobalObject *GO,    return true;  } -bool HexagonTargetObjectFile::isSmallDataEnabled() const { -  return SmallDataThreshold > 0; +bool HexagonTargetObjectFile::isSmallDataEnabled(const TargetMachine &TM) +    const { +  return SmallDataThreshold > 0 && !TM.isPositionIndependent();  }  unsigned HexagonTargetObjectFile::getSmallDataSize() const {  | 
