Skip to content

Commit ce2164f

Browse files
committedOct 29, 2014
Fix getRelocationValueString to return the symbol name for EM_386.
Summary: This helps llvm-objdump -r to print out the symbol name along with the relocation type on x86. Adjust existing tests from checking for "Unknown" to check for the symbol now. Test Plan: Adjusted test/Object tests. Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5987 llvm-svn: 220866
1 parent 50ab156 commit ce2164f

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed
 

‎llvm/include/llvm/Object/ELFObjectFile.h

+1
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,7 @@ std::error_code ELFObjectFile<ELFT>::getRelocationValueString(
738738
Result.append(fmtbuf.begin(), fmtbuf.end());
739739
break;
740740
}
741+
case ELF::EM_386:
741742
case ELF::EM_ARM:
742743
case ELF::EM_HEXAGON:
743744
case ELF::EM_MIPS:

‎llvm/test/Object/X86/objdump-disassembly-inline-relocations.test

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ ELF-i386: main:
7676
ELF-i386: 0: 83 ec 0c subl $12, %esp
7777
ELF-i386: 3: c7 44 24 08 00 00 00 00 movl $0, 8(%esp)
7878
ELF-i386: b: c7 04 24 00 00 00 00 movl $0, (%esp)
79-
ELF-i386: e: R_386_32 Unknown
79+
ELF-i386: e: R_386_32 .rodata.str1.1
8080
ELF-i386: 12: e8 fc ff ff ff calll -4
81-
ELF-i386: 13: R_386_PC32 Unknown
81+
ELF-i386: 13: R_386_PC32 puts
8282
ELF-i386: 17: e8 fc ff ff ff calll -4
83-
ELF-i386: 18: R_386_PC32 Unknown
83+
ELF-i386: 18: R_386_PC32 SomeOtherFunction
8484
ELF-i386: 1c: 8b 44 24 08 movl 8(%esp), %eax
8585
ELF-i386: 20: 83 c4 0c addl $12, %esp
8686
ELF-i386: 23: c3 ret

‎llvm/test/Object/objdump-relocations.test

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ COFF-x86-64: IMAGE_REL_AMD64_REL32 puts
2727
COFF-x86-64: IMAGE_REL_AMD64_REL32 SomeOtherFunction
2828

2929
ELF-i386: .text
30-
ELF-i386: R_386_32
31-
ELF-i386: R_386_PC32
32-
ELF-i386: R_386_PC32
30+
ELF-i386: R_386_32 .rodata.str1.1
31+
ELF-i386: R_386_PC32 puts
32+
ELF-i386: R_386_PC32 SomeOtherFunction
3333

3434
ELF-x86-64: .text
3535
ELF-x86-64: R_X86_64_32S .rodata.str1.1

0 commit comments

Comments
 (0)