diff options
-rw-r--r-- | include/llvm/Object/ELF.h | 5 | ||||
-rw-r--r-- | test/Object/ARM/symbol-addr.ll | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/llvm/Object/ELF.h b/include/llvm/Object/ELF.h index b0d8663..fa75053 100644 --- a/include/llvm/Object/ELF.h +++ b/include/llvm/Object/ELF.h @@ -1058,6 +1058,11 @@ error_code ELFObjectFile<ELFT>::getSymbolAddress(DataRefImpl Symb, IsRelocatable = true; } Result = symb->st_value; + + // Clear the ARM/Thumb indicator flag. + if (Header->e_machine == ELF::EM_ARM) + Result &= ~1; + if (IsRelocatable && Section != 0) Result += Section->sh_addr; return object_error::success; diff --git a/test/Object/ARM/symbol-addr.ll b/test/Object/ARM/symbol-addr.ll new file mode 100644 index 0000000..6bcbde9 --- /dev/null +++ b/test/Object/ARM/symbol-addr.ll @@ -0,0 +1,12 @@ +; RUN: llc %s -mtriple=arm-unknown-unknown -filetype=obj -o - \ +; RUN: | llvm-objdump -t - | FileCheck %s +; RUN: llc %s -mtriple=thumb-unknown-unknown -filetype=obj -o - \ +; RUN: | llvm-objdump -t - | FileCheck %s + +; Check that the symbol address does not include the ARM/Thumb instruction +; indicator bit. +; CHECK: 00000000 g F .text {{[0-9]+}} test + +define i32 @test() { + ret i32 1 +} |