summaryrefslogtreecommitdiff
path: root/lib/Object/COFFObjectFile.cpp
diff options
context:
space:
mode:
authorDavid Meyer <pdox@google.com>2012-02-29 02:11:55 +0000
committerDavid Meyer <pdox@google.com>2012-02-29 02:11:55 +0000
commit2c67727046234ad9702ab5acb72700b5ac99a676 (patch)
tree8dccb4673583b529cf8ca2a898407105b5c01f91 /lib/Object/COFFObjectFile.cpp
parent37c02bce277078902924af897736d87bb0b106a0 (diff)
downloadllvm-2c67727046234ad9702ab5acb72700b5ac99a676.tar.gz
llvm-2c67727046234ad9702ab5acb72700b5ac99a676.tar.bz2
llvm-2c67727046234ad9702ab5acb72700b5ac99a676.tar.xz
[Object] Add symbol attribute flags: ST_ThreadLocal, ST_Common, and ST_Undefined. Implement these completely for ELF.
Rename ST_External to ST_Unknown, and slightly change its semantics. It now only indicates that the symbol's type is unknown, not that the symbol is undefined. (For that, use ST_Undefined). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151696 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object/COFFObjectFile.cpp')
-rw-r--r--lib/Object/COFFObjectFile.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp
index bf278785e6..d55aba5ce9 100644
--- a/lib/Object/COFFObjectFile.cpp
+++ b/lib/Object/COFFObjectFile.cpp
@@ -143,7 +143,7 @@ error_code COFFObjectFile::getSymbolType(DataRefImpl Symb,
Result = SymbolRef::ST_Other;
if (symb->StorageClass == COFF::IMAGE_SYM_CLASS_EXTERNAL &&
symb->SectionNumber == COFF::IMAGE_SYM_UNDEFINED) {
- Result = SymbolRef::ST_External;
+ Result = SymbolRef::ST_Unknown;
} else {
if (symb->getComplexType() == COFF::IMAGE_SYM_DTYPE_FUNCTION) {
Result = SymbolRef::ST_Function;
@@ -164,7 +164,11 @@ error_code COFFObjectFile::getSymbolFlags(DataRefImpl Symb,
const coff_symbol *symb = toSymb(Symb);
Result = SymbolRef::SF_None;
- // TODO: Set SF_FormatSpecific.
+ // TODO: Correctly set SF_FormatSpecific, SF_ThreadLocal, SF_Common
+
+ if (symb->StorageClass == COFF::IMAGE_SYM_CLASS_EXTERNAL &&
+ symb->SectionNumber == COFF::IMAGE_SYM_UNDEFINED)
+ Result |= SymbolRef::SF_Undefined;
// TODO: This are certainly too restrictive.
if (symb->StorageClass == COFF::IMAGE_SYM_CLASS_EXTERNAL)