[Object][Mips] Return address of MIPS symbol with cleared microMIPS indicator bit

llvm-svn: 222726
This commit is contained in:
Simon Atanasyan 2014-11-25 05:57:55 +00:00
parent 906b92c9d0
commit b1231365ea
3 changed files with 15 additions and 2 deletions

View File

@ -280,8 +280,9 @@ std::error_code ELFObjectFile<ELFT>::getSymbolAddress(DataRefImpl Symb,
const Elf_Ehdr *Header = EF.getHeader();
Result = ESym->st_value;
// Clear the ARM/Thumb indicator flag.
if (Header->e_machine == ELF::EM_ARM && ESym->getType() == ELF::STT_FUNC)
// Clear the ARM/Thumb or microMIPS indicator flag.
if ((Header->e_machine == ELF::EM_ARM || Header->e_machine == ELF::EM_MIPS) &&
ESym->getType() == ELF::STT_FUNC)
Result &= ~1;
if (Header->e_type == ELF::ET_REL)

Binary file not shown.

View File

@ -0,0 +1,12 @@
RUN: llvm-objdump -d -mattr=micromips %p/../Inputs/micro-mips.elf-mipsel \
RUN: | FileCheck %s
CHECK: foo:
CHECK-NEXT: 330: bd 33 f8 ff addiu $sp, $sp, -8
CHECK-NEXT: 334: dd fb 04 00 sw $fp, 4($sp)
CHECK-NEXT: 338: 1d 00 50 f1 addu $fp, $sp, $zero
CHECK: bar:
CHECK-NEXT: 350: a2 41 02 00 lui $2, 2
CHECK-NEXT: 354: 42 30 8f 80 addiu $2, $2, -32625
CHECK-NEXT: 358: bd 33 e8 ff addiu $sp, $sp, -24