aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-02-02 22:28:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-02-02 22:28:12 +0000
commit07577dfe2e600630872f80f3061834189fb208a3 (patch)
tree5ade07f8082cad420cc8594ea73e6addbac2ce8d /contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp
parent875b18b5200a64b9a6c5290e6821399f8f1c26fa (diff)
parent6d18171c1901a4db5d3e757a5ba4737fe8789dec (diff)
Notes
Diffstat (limited to 'contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp')
-rw-r--r--contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp b/contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp
index 9db6b7b1bcd6..f767c8321988 100644
--- a/contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp
+++ b/contrib/llvm/lib/Target/Mips/MipsTargetObjectFile.cpp
@@ -136,6 +136,13 @@ IsGlobalInSmallSectionImpl(const GlobalObject *GO,
return false;
Type *Ty = GVA->getValueType();
+
+ // It is possible that the type of the global is unsized, i.e. a declaration
+ // of a extern struct. In this case don't presume it is in the small data
+ // section. This happens e.g. when building the FreeBSD kernel.
+ if (!Ty->isSized())
+ return false;
+
return IsInSmallSection(
GVA->getParent()->getDataLayout().getTypeAllocSize(Ty));
}