[llvm] r265387 - Set the thumb flag for thumb symbols coming from an ELF file

Tamas Berghammer via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 5 05:11:41 PDT 2016


Author: tberghammer
Date: Tue Apr  5 07:11:40 2016
New Revision: 265387

URL: http://llvm.org/viewvc/llvm-project?rev=265387&view=rev
Log:
Set the thumb flag for thumb symbols coming from an ELF file

Without setting the flag there is no way to determine if a symbol
points to an arm or to a thumb function as the LSB of the address
masked out in all getter function.

Note: Currently the thumb flag is only used for MachO files so
adding a test to this change is not possible. It will be used
by the upcoming fix for llvm-objdump for disassembling thumb
functions what is easily testable.

Differential revision: http://reviews.llvm.org/D17956

Modified:
    llvm/trunk/include/llvm/Object/ELFObjectFile.h

Modified: llvm/trunk/include/llvm/Object/ELFObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=265387&r1=265386&r2=265387&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELFObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/ELFObjectFile.h Tue Apr  5 07:11:40 2016
@@ -494,6 +494,8 @@ uint32_t ELFObjectFile<ELFT>::getSymbolF
           Name.startswith("$a"))
         Result |= SymbolRef::SF_FormatSpecific;
     }
+    if (ESym->getType() == ELF::STT_FUNC && (ESym->st_value & 1) == 1)
+      Result |= SymbolRef::SF_Thumb;
   }
 
   if (ESym->st_shndx == ELF::SHN_UNDEF)




More information about the llvm-commits mailing list