Fix SymbolRef::getAddress implementation for ELF. The 'value' field in symbol table entry should be treated differently for relocatable and relocated files. This patch fixes symbol addresses printed by llvm-nm for executables and shared objects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164365 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alexey Samsonov
2012-09-21 07:08:08 +00:00
parent f17422181f
commit 01fa41a106
4 changed files with 39 additions and 10 deletions

View File

@ -1,15 +1,23 @@
RUN: llvm-nm -D %p/Inputs/shared-object-test.elf-i386 \
RUN: | FileCheck %s -check-prefix ELF
RUN: | FileCheck %s -check-prefix ELF-32
RUN: llvm-nm -D %p/Inputs/shared-object-test.elf-x86-64 \
RUN: | FileCheck %s -check-prefix ELF
RUN: | FileCheck %s -check-prefix ELF-64
; Note: tls_sym should be 'D' (not '?'), but TLS is not
; yet recognized by ObjectFile.
ELF: {{[0-9a-f]+}} A __bss_start
ELF: {{[0-9a-f]+}} A _edata
ELF: {{[0-9a-f]+}} A _end
ELF: {{[0-9a-f]+}} B common_sym
ELF: {{[0-9a-f]+}} D defined_sym
ELF: {{[0-9a-f]+}} T global_func
ELF: ? tls_sym
ELF-32: 0012c8 A __bss_start
ELF-32: 0012c8 A _edata
ELF-32: 0012cc A _end
ELF-32: 0012c8 B common_sym
ELF-32: 0012c4 D defined_sym
ELF-32: 0001f0 T global_func
ELF-32: ? tls_sym
ELF-64: 200454 A __bss_start
ELF-64: 200454 A _edata
ELF-64: 200458 A _end
ELF-64: 200454 B common_sym
ELF-64: 200450 D defined_sym
ELF-64: 0002f0 T global_func
ELF-64: ? tls_sym