summaryrefslogtreecommitdiffstats
path: root/llvm/test/Object/relocation-executable.test
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-05-30 03:05:14 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-05-30 03:05:14 +0000
commit4f60a38f18ee68c4abd4cfefb5a4bba0f0917f16 (patch)
treed985d7ef7568fb038232b2b0edd8e2545bb3f8e4 /llvm/test/Object/relocation-executable.test
parent194a79e152616a9433d9af13877d3014b4742f43 (diff)
downloadbcm5719-llvm-4f60a38f18ee68c4abd4cfefb5a4bba0f0917f16.tar.gz
bcm5719-llvm-4f60a38f18ee68c4abd4cfefb5a4bba0f0917f16.zip
Change how we iterate over relocations on ELF.
For COFF and MachO, sections semantically have relocations that apply to them. That is not the case on ELF. In relocatable objects (.o), a section with relocations in ELF has offsets to another section where the relocations should be applied. In dynamic objects and executables, relocations don't have an offset, they have a virtual address. The section sh_info may or may not point to another section, but that is not actually used for resolving the relocations. This patch exposes that in the ObjectFile API. It has the following advantages: * Most (all?) clients can handle this more efficiently. They will normally walk all relocations, so doing an effort to iterate in a particular order doesn't save time. * llvm-readobj now prints relocations in the same way the native readelf does. * probably most important, relocations that don't point to any section are now visible. This is the case of relocations in the rela.dyn section. See the updated relocation-executable.test for example. llvm-svn: 182908
Diffstat (limited to 'llvm/test/Object/relocation-executable.test')
-rw-r--r--llvm/test/Object/relocation-executable.test10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/test/Object/relocation-executable.test b/llvm/test/Object/relocation-executable.test
index 7625ec20af6..1236035d9f6 100644
--- a/llvm/test/Object/relocation-executable.test
+++ b/llvm/test/Object/relocation-executable.test
@@ -2,7 +2,15 @@ RUN: llvm-readobj -r -expand-relocs %p/Inputs/hello-world.elf-x86-64 \
RUN: | FileCheck %s
// CHECK: Relocations [
-// CHECK: Section (11) .plt {
+// CHECK-NEXT: Section (8) .rela.dyn {
+// CHECK-NEXT: Relocation {
+// CHECK-NEXT: Offset: 0x4018D8
+// CHECK-NEXT: Type: R_X86_64_GLOB_DAT (6)
+// CHECK-NEXT: Symbol: __gmon_start__
+// CHECK-NEXT: Addend: 0x0
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: Section (9) .rela.plt {
// CHECK-NEXT: Relocation {
// CHECK-NEXT: Offset: 0x4018F8
// CHECK-NEXT: Type: R_X86_64_JUMP_SLOT (7)
OpenPOWER on IntegriCloud