Use the information provided by getFlags to unify some code in llvm-nm.
It is not clear how much we should try to expose in getFlags. For example,
should there be a SF_Object and a SF_Text?
But for information that is already being exposed, we may as well use it in
llvm-nm.
llvm-svn: 200820
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index 3475ac5..a604acd 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -161,9 +161,13 @@
// TODO: Correctly set SF_FormatSpecific, SF_Common
- if (Symb->StorageClass == COFF::IMAGE_SYM_CLASS_EXTERNAL &&
- Symb->SectionNumber == COFF::IMAGE_SYM_UNDEFINED)
- Result |= SymbolRef::SF_Undefined;
+ if (Symb->SectionNumber == COFF::IMAGE_SYM_UNDEFINED) {
+ if (Symb->Value == 0)
+ Result |= SymbolRef::SF_Undefined;
+ else
+ Result |= SymbolRef::SF_Common;
+ }
+
// TODO: This are certainly too restrictive.
if (Symb->StorageClass == COFF::IMAGE_SYM_CLASS_EXTERNAL)