From 6d18171c1901a4db5d3e757a5ba4737fe8789dec Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 2 Feb 2018 17:07:53 +0000 Subject: Vendor import of llvm release_60 branch r324090: https://llvm.org/svn/llvm-project/llvm/branches/release_60@324090 --- lib/Target/Mips/MipsTargetObjectFile.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/Target/Mips/MipsTargetObjectFile.cpp') diff --git a/lib/Target/Mips/MipsTargetObjectFile.cpp b/lib/Target/Mips/MipsTargetObjectFile.cpp index 9db6b7b1bcd6..f767c8321988 100644 --- a/lib/Target/Mips/MipsTargetObjectFile.cpp +++ b/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)); } -- cgit v1.3