diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-09-18 15:03:21 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-09-18 15:03:21 +0000 |
| commit | 57e599a82a3da86d825f830afe337cf98fc97aa1 (patch) | |
| tree | 325bd33c7d01d5c58be58978ecb65fa29ee5228c /llvm/lib/MC | |
| parent | 45a56d3c492831cfc5af3431463fe162e70e343a (diff) | |
| download | bcm5719-llvm-57e599a82a3da86d825f830afe337cf98fc97aa1.tar.gz bcm5719-llvm-57e599a82a3da86d825f830afe337cf98fc97aa1.zip | |
Make sure the STT_FILE symbol is the first one in the symbol table.
llvm-svn: 114285
Diffstat (limited to 'llvm/lib/MC')
| -rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index d0fc9cac479..35f029d2fa1 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -34,6 +34,15 @@ #include <vector> using namespace llvm; +static unsigned GetType(const MCSymbolData &SD) { + uint32_t Type = (SD.getFlags() & (0xf << ELF_STT_Shift)) >> ELF_STT_Shift; + assert(Type == ELF::STT_NOTYPE || Type == ELF::STT_OBJECT || + Type == ELF::STT_FUNC || Type == ELF::STT_SECTION || + Type == ELF::STT_FILE || Type == ELF::STT_COMMON || + Type == ELF::STT_TLS); + return Type; +} + namespace { class ELFObjectWriterImpl { @@ -64,6 +73,10 @@ namespace { // Support lexicographic sorting. bool operator<(const ELFSymbolData &RHS) const { + if (GetType(*SymbolData) == ELF::STT_FILE) + return true; + if (GetType(*RHS.SymbolData) == ELF::STT_FILE) + return false; return SymbolData->getSymbol().getName() < RHS.SymbolData->getSymbol().getName(); } |

