diff options
Diffstat (limited to 'llvm/lib/Target/TargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/TargetMachine.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp index 178d199..4258a76 100644 --- a/llvm/lib/Target/TargetMachine.cpp +++ b/llvm/lib/Target/TargetMachine.cpp @@ -85,7 +85,11 @@ bool TargetMachine::isLargeGlobalValue(const GlobalValue *GVal) const { getCodeModel() == CodeModel::Large) { if (!GV->getValueType()->isSized()) return true; - if (GV->isDeclaration() && GV->getName() == "__ehdr_start") + // Linker defined start/stop symbols can point to arbitrary points in the + // binary, so treat them as large. + if (GV->isDeclaration() && (GV->getName() == "__ehdr_start" || + GV->getName().starts_with("__start_") || + GV->getName().starts_with("__stop_"))) return true; const DataLayout &DL = GV->getParent()->getDataLayout(); uint64_t Size = DL.getTypeSizeInBits(GV->getValueType()) / 8; |