From 9ef844165ada5697b5afbb2c0c47ed9a342d6e8a Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 11 Apr 2014 19:18:01 +0000 Subject: Don't lose the thumb bit by using relocations with sections. This fixes a regression from r205076. llvm-svn: 206047 --- llvm/lib/MC/ELFObjectWriter.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'llvm/lib/MC/ELFObjectWriter.cpp') diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index e802c01fea1..cd92b75a7f0 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; -- cgit v1.2.3