[llvm] r219324 - Correctly compute the size of common symbols in COFF.
Rafael Espindola
rafael.espindola at gmail.com
Wed Oct 8 10:37:19 PDT 2014
Author: rafael
Date: Wed Oct 8 12:37:19 2014
New Revision: 219324
URL: http://llvm.org/viewvc/llvm-project?rev=219324&view=rev
Log:
Correctly compute the size of common symbols in COFF.
Modified:
llvm/trunk/lib/Object/COFFObjectFile.cpp
llvm/trunk/test/Object/nm-trivial-object.test
Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=219324&r1=219323&r2=219324&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp Wed Oct 8 12:37:19 2014
@@ -222,12 +222,17 @@ std::error_code COFFObjectFile::getSymbo
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;
}
Modified: llvm/trunk/test/Object/nm-trivial-object.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/nm-trivial-object.test?rev=219324&r1=219323&r2=219324&view=diff
==============================================================================
--- llvm/trunk/test/Object/nm-trivial-object.test (original)
+++ llvm/trunk/test/Object/nm-trivial-object.test Wed Oct 8 12:37:19 2014
@@ -62,7 +62,7 @@ COFF-COMMON-NEXT: 00000000 00000014 d .d
COFF-COMMON-NEXT: 00000000 00000000 n .file
COFF-COMMON-NEXT: 00000000 00000014 r .rdata$zzz
COFF-COMMON-NEXT: 00000000 00000000 t .text
-COFF-COMMON-NEXT: C _a
+COFF-COMMON-NEXT: 00000004 C _a
ELF-NOT: U
More information about the llvm-commits
mailing list