summaryrefslogtreecommitdiff
path: root/include/llvm/Object
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Object')
-rw-r--r--include/llvm/Object/ELF.h20
-rw-r--r--include/llvm/Object/ObjectFile.h15
2 files changed, 24 insertions, 11 deletions
diff --git a/include/llvm/Object/ELF.h b/include/llvm/Object/ELF.h
index e6442f14be..6e3fa013af 100644
--- a/include/llvm/Object/ELF.h
+++ b/include/llvm/Object/ELF.h
@@ -625,12 +625,10 @@ error_code ELFObjectFile<target_endianness, is64Bits>
validateSymbol(Symb);
const Elf_Sym *symb = getSymbol(Symb);
- if (getSymbolTableIndex(symb) == ELF::SHN_UNDEF) {
- Result = SymbolRef::ST_External;
- return object_error::success;
- }
-
switch (symb->getType()) {
+ case ELF::STT_NOTYPE:
+ Result = SymbolRef::ST_Unknown;
+ break;
case ELF::STT_SECTION:
Result = SymbolRef::ST_Debug;
break;
@@ -641,6 +639,8 @@ error_code ELFObjectFile<target_endianness, is64Bits>
Result = SymbolRef::ST_Function;
break;
case ELF::STT_OBJECT:
+ case ELF::STT_COMMON:
+ case ELF::STT_TLS:
Result = SymbolRef::ST_Data;
break;
default:
@@ -672,6 +672,16 @@ error_code ELFObjectFile<target_endianness, is64Bits>
symb->getType() == ELF::STT_SECTION)
Result |= SymbolRef::SF_FormatSpecific;
+ if (getSymbolTableIndex(symb) == ELF::SHN_UNDEF)
+ Result |= SymbolRef::SF_Undefined;
+
+ if (symb->getType() == ELF::STT_COMMON ||
+ getSymbolTableIndex(symb) == ELF::SHN_COMMON)
+ Result |= SymbolRef::SF_Common;
+
+ if (symb->getType() == ELF::STT_TLS)
+ Result |= SymbolRef::SF_ThreadLocal;
+
return object_error::success;
}
diff --git a/include/llvm/Object/ObjectFile.h b/include/llvm/Object/ObjectFile.h
index 284577c945..56d8c249c7 100644
--- a/include/llvm/Object/ObjectFile.h
+++ b/include/llvm/Object/ObjectFile.h
@@ -180,9 +180,9 @@ public:
}
enum Type {
+ ST_Unknown, // Type not specified
ST_Data,
ST_Debug,
- ST_External, // Defined in another object file
ST_File,
ST_Function,
ST_Other
@@ -190,11 +190,14 @@ public:
enum Flags {
SF_None = 0,
- SF_Global = 1 << 0, // Global symbol
- SF_Weak = 1 << 1, // Weak symbol
- SF_Absolute = 1 << 2, // Absolute symbol
- SF_FormatSpecific = 1 << 3 // Specific to the object file format
- // (e.g. section symbols)
+ SF_Undefined = 1U << 0, // Symbol is defined in another object file
+ SF_Global = 1U << 1, // Global symbol
+ SF_Weak = 1U << 2, // Weak symbol
+ SF_Absolute = 1U << 3, // Absolute symbol
+ SF_ThreadLocal = 1U << 4, // Thread local symbol
+ SF_Common = 1U << 5, // Symbol has common linkage
+ SF_FormatSpecific = 1U << 31 // Specific to the object file format
+ // (e.g. section symbols)
};
SymbolRef(DataRefImpl SymbolP, const ObjectFile *Owner);