From 8280fbbf9f11c93c5ea90ef6df48099308d327fd Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 8 Oct 2014 17:37:19 +0000 Subject: Correctly compute the size of common symbols in COFF. llvm-svn: 219324 --- llvm/lib/Object/COFFObjectFile.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Object/COFFObjectFile.cpp') diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp index 3e66855..ebf24a9 100644 --- a/llvm/lib/Object/COFFObjectFile.cpp +++ b/llvm/lib/Object/COFFObjectFile.cpp @@ -222,12 +222,17 @@ std::error_code COFFObjectFile::getSymbolSize(DataRefImpl Ref, if (std::error_code EC = getSection(Symb.getSectionNumber(), Section)) return EC; - if (Symb.getSectionNumber() == COFF::IMAGE_SYM_UNDEFINED) - Result = UnknownAddressOrSize; - else if (Section) + if (Symb.getSectionNumber() == COFF::IMAGE_SYM_UNDEFINED) { + if (Symb.getValue() == 0) + Result = UnknownAddressOrSize; + else + Result = Symb.getValue(); + } else if (Section) { Result = Section->SizeOfRawData - Symb.getValue(); - else + } else { Result = 0; + } + return object_error::success; } -- cgit v1.1