diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-30 03:05:14 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-30 03:05:14 +0000 |
commit | 7486d92a6c949a193bb75c0ffa0170eeb2fabb80 (patch) | |
tree | ca8e73e165c5f83e01e2d97998f7baf7cd711f7e /test/CodeGen/AArch64 | |
parent | d2df98f3aad701512c6f14579a24672a49df1150 (diff) | |
download | external_llvm-7486d92a6c949a193bb75c0ffa0170eeb2fabb80.zip external_llvm-7486d92a6c949a193bb75c0ffa0170eeb2fabb80.tar.gz external_llvm-7486d92a6c949a193bb75c0ffa0170eeb2fabb80.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182908 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/AArch64')
-rw-r--r-- | test/CodeGen/AArch64/adrp-relocation.ll | 2 | ||||
-rw-r--r-- | test/CodeGen/AArch64/basic-pic.ll | 2 | ||||
-rw-r--r-- | test/CodeGen/AArch64/elf-extern.ll | 2 | ||||
-rw-r--r-- | test/CodeGen/AArch64/jump-table.ll | 4 |
4 files changed, 5 insertions, 5 deletions
diff --git a/test/CodeGen/AArch64/adrp-relocation.ll b/test/CodeGen/AArch64/adrp-relocation.ll index cf41116..1e12d69 100644 --- a/test/CodeGen/AArch64/adrp-relocation.ll +++ b/test/CodeGen/AArch64/adrp-relocation.ll @@ -20,7 +20,7 @@ entry: ; object file's .text section gets relocated in memory. ; CHECK: Relocations [ -; CHECK-NEXT: Section (1) .text { +; CHECK-NEXT: Section (2) .rela.text { ; CHECK-NEXT: 0x10 R_AARCH64_ADR_PREL_PG_HI21 testfn 0x0 ; CHECK-NEXT: 0x14 R_AARCH64_ADD_ABS_LO12_NC testfn 0x0 ; CHECK-NEXT: } diff --git a/test/CodeGen/AArch64/basic-pic.ll b/test/CodeGen/AArch64/basic-pic.ll index da94041..5343cc7 100644 --- a/test/CodeGen/AArch64/basic-pic.ll +++ b/test/CodeGen/AArch64/basic-pic.ll @@ -3,7 +3,7 @@ @var = global i32 0 -; CHECK-ELF: RELOCATION RECORDS FOR [.text] +; CHECK-ELF: RELOCATION RECORDS FOR [.rela.text] define i32 @get_globalvar() { ; CHECK: get_globalvar: diff --git a/test/CodeGen/AArch64/elf-extern.ll b/test/CodeGen/AArch64/elf-extern.ll index 8bf1b2f..e09aa12 100644 --- a/test/CodeGen/AArch64/elf-extern.ll +++ b/test/CodeGen/AArch64/elf-extern.ll @@ -11,7 +11,7 @@ define i32 @check_extern() { } ; CHECK: Relocations [ -; CHECK: Section (1) .text { +; CHECK: Section (2) .rela.text { ; CHECK: 0x{{[0-9,A-F]+}} R_AARCH64_CALL26 memcpy ; CHECK: } ; CHECK: ] diff --git a/test/CodeGen/AArch64/jump-table.ll b/test/CodeGen/AArch64/jump-table.ll index 3c7f5f9..0f1e760 100644 --- a/test/CodeGen/AArch64/jump-table.ll +++ b/test/CodeGen/AArch64/jump-table.ll @@ -54,13 +54,13 @@ lbl4: ; First make sure we get a page/lo12 pair in .text to pick up the jump-table ; CHECK-ELF: Relocations [ -; CHECK-ELF: Section ({{[0-9]+}}) .text { +; CHECK-ELF: Section ({{[0-9]+}}) .rela.text { ; CHECK-ELF-NEXT: 0x{{[0-9,A-F]+}} R_AARCH64_ADR_PREL_PG_HI21 .rodata ; CHECK-ELF-NEXT: 0x{{[0-9,A-F]+}} R_AARCH64_ADD_ABS_LO12_NC .rodata ; CHECK-ELF: } ; Also check the targets in .rodata are relocated -; CHECK-ELF: Section ({{[0-9]+}}) .rodata { +; CHECK-ELF: Section ({{[0-9]+}}) .rela.rodata { ; CHECK-ELF-NEXT: 0x{{[0-9,A-F]+}} R_AARCH64_ABS64 .text ; CHECK-ELF: } ; CHECK-ELF: ] |