From 3262c451c490d9cd6dd83caa61f6d31125bf8e3e Mon Sep 17 00:00:00 2001 From: Jan Wen Voung Date: Wed, 29 Oct 2014 18:37:13 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220866 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/ELFObjectFile.h | 1 + test/Object/X86/objdump-disassembly-inline-relocations.test | 6 +++--- test/Object/objdump-relocations.test | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/llvm/Object/ELFObjectFile.h b/include/llvm/Object/ELFObjectFile.h index 4676ae8bdbc..3fcd98de9dc 100644 --- a/include/llvm/Object/ELFObjectFile.h +++ b/include/llvm/Object/ELFObjectFile.h @@ -738,6 +738,7 @@ std::error_code ELFObjectFile::getRelocationValueString( Result.append(fmtbuf.begin(), fmtbuf.end()); break; } + case ELF::EM_386: case ELF::EM_ARM: case ELF::EM_HEXAGON: case ELF::EM_MIPS: diff --git a/test/Object/X86/objdump-disassembly-inline-relocations.test b/test/Object/X86/objdump-disassembly-inline-relocations.test index 78615765046..3871bcbf0b5 100644 --- a/test/Object/X86/objdump-disassembly-inline-relocations.test +++ b/test/Object/X86/objdump-disassembly-inline-relocations.test @@ -76,11 +76,11 @@ ELF-i386: main: ELF-i386: 0: 83 ec 0c subl $12, %esp ELF-i386: 3: c7 44 24 08 00 00 00 00 movl $0, 8(%esp) ELF-i386: b: c7 04 24 00 00 00 00 movl $0, (%esp) -ELF-i386: e: R_386_32 Unknown +ELF-i386: e: R_386_32 .rodata.str1.1 ELF-i386: 12: e8 fc ff ff ff calll -4 -ELF-i386: 13: R_386_PC32 Unknown +ELF-i386: 13: R_386_PC32 puts ELF-i386: 17: e8 fc ff ff ff calll -4 -ELF-i386: 18: R_386_PC32 Unknown +ELF-i386: 18: R_386_PC32 SomeOtherFunction ELF-i386: 1c: 8b 44 24 08 movl 8(%esp), %eax ELF-i386: 20: 83 c4 0c addl $12, %esp ELF-i386: 23: c3 ret diff --git a/test/Object/objdump-relocations.test b/test/Object/objdump-relocations.test index 28cac104c7b..1e41f78ca72 100644 --- a/test/Object/objdump-relocations.test +++ b/test/Object/objdump-relocations.test @@ -27,9 +27,9 @@ COFF-x86-64: IMAGE_REL_AMD64_REL32 puts COFF-x86-64: IMAGE_REL_AMD64_REL32 SomeOtherFunction ELF-i386: .text -ELF-i386: R_386_32 -ELF-i386: R_386_PC32 -ELF-i386: R_386_PC32 +ELF-i386: R_386_32 .rodata.str1.1 +ELF-i386: R_386_PC32 puts +ELF-i386: R_386_PC32 SomeOtherFunction ELF-x86-64: .text ELF-x86-64: R_X86_64_32S .rodata.str1.1