summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2019-06-23 21:36:31 +0000
committerpatrick <patrick@openbsd.org>2019-06-23 21:36:31 +0000
commit23f101f37937a1bd4a29726cab2f76e0fb038b35 (patch)
treef7da7d6b32c2e07114da399150bfa88d72187012 /gnu/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
parentsort previous; ok deraadt (diff)
downloadwireguard-openbsd-23f101f37937a1bd4a29726cab2f76e0fb038b35.tar.xz
wireguard-openbsd-23f101f37937a1bd4a29726cab2f76e0fb038b35.zip
Import LLVM 8.0.0 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp')
-rw-r--r--gnu/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/gnu/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp b/gnu/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
index e771f383dff..2185bf8eebc 100644
--- a/gnu/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
+++ b/gnu/llvm/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 {