summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Writer.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-08-14 15:10:49 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-08-14 15:10:49 +0000
commitc44d17ad45f450cef0db15aea7b420161b2d5514 (patch)
tree35cbcbb033cd00b18489b7d5e3fb20dee00effb7 /lld/ELF/Writer.cpp
parent457c9408355826032f415ab11a466ffb58a33b28 (diff)
downloadbcm5719-llvm-c44d17ad45f450cef0db15aea7b420161b2d5514.tar.gz
bcm5719-llvm-c44d17ad45f450cef0db15aea7b420161b2d5514.zip
Add the type of the symbols to the symbol table.
For now only defined symbols are covered. I will add undefined ones in the next patch. llvm-svn: 245057
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r--lld/ELF/Writer.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 9902cc4e19d..74139b2f2d7 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -220,18 +220,23 @@ template <class ELFT> void SymbolTableSection<ELFT>::writeTo(uint8_t *Buf) {
auto *ESym = reinterpret_cast<Elf_Sym *>(Buf);
ESym->st_name = Builder.getOffset(Name);
uint8_t Binding;
- switch (Sym->Body->kind()) {
+ SymbolBody *Body = Sym->Body;
+ uint8_t Type = 0;
+ switch (Body->kind()) {
case SymbolBody::UndefinedKind:
llvm_unreachable("Should be defined by now");
case SymbolBody::DefinedRegularKind:
Binding = STB_GLOBAL;
+ Type = cast<DefinedRegular<ELFT>>(Body)->Sym.getType();
break;
- case SymbolBody::UndefinedWeakKind:
case SymbolBody::DefinedWeakKind:
+ Type = cast<DefinedWeak<ELFT>>(Body)->Sym.getType();
+ // Fallthrough
+ case SymbolBody::UndefinedWeakKind:
Binding = STB_WEAK;
break;
}
- ESym->setBindingAndType(Binding, 0);
+ ESym->setBindingAndType(Binding, Type);
Buf += sizeof(Elf_Sym);
}
OpenPOWER on IntegriCloud