aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-04-11 19:18:01 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-04-11 19:18:01 +0000
commit9ef844165ada5697b5afbb2c0c47ed9a342d6e8a (patch)
treeea14e64663bdf04092670550ff802f4a26c5b2c1 /llvm/lib/MC/ELFObjectWriter.cpp
parent63fb6efd032b551952d12c7bef8399fad6a0bab0 (diff)
downloadllvm-9ef844165ada5697b5afbb2c0c47ed9a342d6e8a.zip
llvm-9ef844165ada5697b5afbb2c0c47ed9a342d6e8a.tar.gz
llvm-9ef844165ada5697b5afbb2c0c47ed9a342d6e8a.tar.bz2
Don't lose the thumb bit by using relocations with sections.
This fixes a regression from r205076. llvm-svn: 206047
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index e802c01..cd92b75 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -813,6 +813,13 @@ bool ELFObjectWriter::shouldRelocateWithSymbol(const MCSymbolRefExpr *RefA,
if (Flags & ELF::SHF_TLS)
return true;
+ // If the symbol is a thumb function the final relocation must set the lowest
+ // bit. With a symbol that is done by just having the symbol have that bit
+ // set, so we would lose the bit if we relocated with the section.
+ // FIXME: We could use the section but add the bit to the relocation value.
+ if (SD->getFlags() & ELF_Other_ThumbFunc)
+ return true;
+
if (TargetObjectWriter->needsRelocateWithSymbol(Type))
return true;
return false;