/// section.
bool HexagonTargetObjectFile::isGlobalInSmallSection(const GlobalObject *GO,
const TargetMachine &TM) const {
- if (!isSmallDataEnabled(TM)) {
- LLVM_DEBUG(dbgs() << "Small data is not available.\n");
- return false;
- }
-
+ 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() << "\": ");
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;
--- /dev/null
+; RUN: llc -march=hexagon -hexagon-small-data-threshold=0 < %s | FileCheck %s
+; RUN: llc -march=hexagon -relocation-model=pic < %s | FileCheck %s
+
+; CHECK: .section .sdata.4,"aws",@progbits
+@g0 = global i32 zeroinitializer, section ".sdata"
+