diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:01:25 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:01:25 +0000 |
| commit | d8e91e46262bc44006913e6796843909f1ac7bcd (patch) | |
| tree | 7d0c143d9b38190e0fa0180805389da22cd834c5 /lib/Target/Hexagon/HexagonTargetObjectFile.cpp | |
| parent | b7eb8e35e481a74962664b63dfb09483b200209a (diff) | |
Notes
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 { |
