Only clear the thumb bit from function addresses.

llvm-svn: 205500
This commit is contained in:
Rafael Espindola 2014-04-03 02:20:43 +00:00
parent 2a579bcc8e
commit 5091f93cdd
3 changed files with 10 additions and 1 deletions

View File

@ -292,7 +292,8 @@ error_code ELFObjectFile<ELFT>::getSymbolAddress(DataRefImpl Symb,
Result = ESym->st_value;
// Clear the ARM/Thumb indicator flag.
if (Header->e_machine == ELF::EM_ARM)
if (EF.getHeader()->e_machine == ELF::EM_ARM &&
ESym->getType() == ELF::STT_FUNC)
Result &= ~1;
if (Header->e_type == ELF::ET_REL)

Binary file not shown.

View File

@ -18,6 +18,9 @@ RUN: llvm-nm %p/Inputs/common.coff-i386 \
RUN: | FileCheck %s -check-prefix COFF-COMMON
RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
RUN: | FileCheck %s -check-prefix ELF-SEC-ADDR
RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
RUN: | FileCheck %s -check-prefix ELF-THUMB
COFF: 00000000 d .data
COFF: 00000000 t .text
@ -64,3 +67,8 @@ ELF-SEC-ADDR-NEXT: 0000005c D b
ELF-SEC-ADDR-NEXT: 00000040 T f
ELF-SEC-ADDR-NEXT: 00000050 T g
ELF-SEC-ADDR-NEXT: 00000060 D p
Test that we drop the thumb bit only from function addresses.
ELF-THUMB: 00000000 t f
ELF-THUMB: 00000003 t g