aboutsummaryrefslogtreecommitdiff
path: root/lib/Object/MachOObjectFile.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/MachOObjectFile.cpp
parent37c02bce277078902924af897736d87bb0b106a0 (diff)
[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/MachOObjectFile.cpp')
-rw-r--r--lib/Object/MachOObjectFile.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp
index cbf6d0b2d8..76a01f94e9 100644
--- a/lib/Object/MachOObjectFile.cpp
+++ b/lib/Object/MachOObjectFile.cpp
@@ -278,7 +278,12 @@ error_code MachOObjectFile::getSymbolFlags(DataRefImpl DRI,
MachOType = Entry->Type;
}
+ // TODO: Correctly set SF_ThreadLocal and SF_Common.
Result = SymbolRef::SF_None;
+
+ if ((MachOType & MachO::NlistMaskType) == MachO::NListTypeUndefined)
+ Result |= SymbolRef::SF_Undefined;
+
if (MachOFlags & macho::STF_StabsEntryMask)
Result |= SymbolRef::SF_FormatSpecific;
@@ -337,7 +342,7 @@ error_code MachOObjectFile::getSymbolType(DataRefImpl Symb,
switch (n_type & MachO::NlistMaskType) {
case MachO::NListTypeUndefined :
- Res = SymbolRef::ST_External;
+ Res = SymbolRef::ST_Unknown;
break;
case MachO::NListTypeSection :
Res = SymbolRef::ST_Function;
@@ -554,7 +559,7 @@ error_code MachOObjectFile::sectionContainsSymbol(DataRefImpl Sec,
bool &Result) const {
SymbolRef::Type ST;
getSymbolType(Symb, ST);
- if (ST == SymbolRef::ST_External) {
+ if (ST == SymbolRef::ST_Unknown) {
Result = false;
return object_error::success;
}