diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-03-26 00:16:43 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-03-26 00:16:43 +0000 |
commit | 85a8491a93a0bf267e69479b5240dac4cd3b3268 (patch) | |
tree | 921de4c4ca9c005b3e5cc925b90e7d4b7fd01911 /llvm/lib | |
parent | 6f12ae0d5c9cce691afd6864b1cab726715779ee (diff) | |
download | bcm5719-llvm-85a8491a93a0bf267e69479b5240dac4cd3b3268.tar.gz bcm5719-llvm-85a8491a93a0bf267e69479b5240dac4cd3b3268.zip |
Correctly detect if a symbol uses a reserved section index or not.
The logic was incorrect for variables, causing them to end up in the wrong
section if the section had an index >= 0xff00.
llvm-svn: 204771
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index eb8b9bfe0ca..7c2135b2487 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -612,13 +612,15 @@ void ELFObjectWriter::WriteSymbol(SymbolTableWriter &Writer, ELFSymbolData &MSD, MCSymbolData &Data = Layout.getAssembler().getSymbolData(OrigData.getSymbol().AliasedSymbol()); - bool IsReserved = Data.isCommon() || Data.getSymbol().isAbsolute() || - Data.getSymbol().isVariable(); + const MCSymbol *Base = getBaseSymbol(Layout, OrigData.getSymbol()); + + // This has to be in sync with when computeSymbolTable uses SHN_ABS or + // SHN_COMMON. + bool IsReserved = !Base || OrigData.isCommon(); // Binding and Type share the same byte as upper and lower nibbles uint8_t Binding = MCELF::GetBinding(OrigData); uint8_t Type = MCELF::GetType(OrigData); - const MCSymbol *Base = getBaseSymbol(Layout, OrigData.getSymbol()); if (Base) { MCSymbolData BaseSD = Layout.getAssembler().getSymbolData(*Base); Type = mergeTypeForSet(Type, MCELF::GetType(BaseSD)); |