summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
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
commit7e4b976c365b592d03caaa2fc51a534736996531 (patch)
tree0cc47b3abac02a0fb45eb5a809ba7dfaa7cea118 /llvm/lib/Object
parent10cea170d25ecd0d98c7cff950d37abc8acae8bb (diff)
downloadbcm5719-llvm-7e4b976c365b592d03caaa2fc51a534736996531.tar.gz
bcm5719-llvm-7e4b976c365b592d03caaa2fc51a534736996531.zip
[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). llvm-svn: 151696
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp8
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp9
2 files changed, 13 insertions, 4 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index bf278785e68..d55aba5ce98 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/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)
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index cbf6d0b2d86..76a01f94e95 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud