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 | 4f60a38f18ee68c4abd4cfefb5a4bba0f0917f16 (patch) | |
tree | d985d7ef7568fb038232b2b0edd8e2545bb3f8e4 /llvm/test/MC/ELF | |
parent | 194a79e152616a9433d9af13877d3014b4742f43 (diff) | |
download | bcm5719-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/MC/ELF')
30 files changed, 119 insertions, 102 deletions
diff --git a/llvm/test/MC/ELF/alias-reloc.s b/llvm/test/MC/ELF/alias-reloc.s index c25c25932f0..f5448e5ffb5 100644 --- a/llvm/test/MC/ELF/alias-reloc.s +++ b/llvm/test/MC/ELF/alias-reloc.s @@ -18,7 +18,7 @@ foo2: .quad bar2 // CHECK: Relocations [ -// CHECK-NEXT: Section ({{[0-9]+}}) zed { +// CHECK-NEXT: Section ({{[0-9]+}}) .relazed { // CHECK-NEXT: 0x1 R_X86_64_PLT32 bar 0xFFFFFFFFFFFFFFFC // CHECK-NEXT: 0x5 R_X86_64_64 bar2 0x0 // CHECK-NEXT: } diff --git a/llvm/test/MC/ELF/basic-elf-32.s b/llvm/test/MC/ELF/basic-elf-32.s index 3ddb53981a9..1f618e1bb6c 100644 --- a/llvm/test/MC/ELF/basic-elf-32.s +++ b/llvm/test/MC/ELF/basic-elf-32.s @@ -45,7 +45,7 @@ main: # @main // CHECK: Name: .rel.text // CHECK: Relocations [ -// CHECK: Section (1) .text { +// CHECK: Section (2) .rel.text { // CHECK: 0x6 R_386_32 .rodata.str1.1 // CHECK: 0xB R_386_PC32 puts // CHECK: 0x12 R_386_32 .rodata.str1.1 diff --git a/llvm/test/MC/ELF/basic-elf-64.s b/llvm/test/MC/ELF/basic-elf-64.s index f98623ad1e3..a77f3e63e09 100644 --- a/llvm/test/MC/ELF/basic-elf-64.s +++ b/llvm/test/MC/ELF/basic-elf-64.s @@ -45,7 +45,7 @@ main: # @main // CHECK: Name: .rela.text // CHECK: Relocations [ -// CHECK: Section (1) .text { +// CHECK: Section (2) .rela.text { // CHECK: 0x5 R_X86_64_32 .rodata.str1.1 0x0 // CHECK: 0xA R_X86_64_PC32 puts 0xFFFFFFFFFFFFFFFC // CHECK: 0xF R_X86_64_32 .rodata.str1.1 0x6 diff --git a/llvm/test/MC/ELF/cfi-adjust-cfa-offset.s b/llvm/test/MC/ELF/cfi-adjust-cfa-offset.s index 137b8b6f849..b3768cb9834 100644 --- a/llvm/test/MC/ELF/cfi-adjust-cfa-offset.s +++ b/llvm/test/MC/ELF/cfi-adjust-cfa-offset.s @@ -26,7 +26,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -49,5 +48,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-advance-loc2.s b/llvm/test/MC/ELF/cfi-advance-loc2.s index 1cad32507cd..d7a53c462b7 100644 --- a/llvm/test/MC/ELF/cfi-advance-loc2.s +++ b/llvm/test/MC/ELF/cfi-advance-loc2.s @@ -24,7 +24,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -46,5 +45,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-def-cfa-offset.s b/llvm/test/MC/ELF/cfi-def-cfa-offset.s index f1a54a810e0..eac2c731fa9 100644 --- a/llvm/test/MC/ELF/cfi-def-cfa-offset.s +++ b/llvm/test/MC/ELF/cfi-def-cfa-offset.s @@ -25,7 +25,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -48,5 +47,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-def-cfa-register.s b/llvm/test/MC/ELF/cfi-def-cfa-register.s index b1e74ea098c..00d8b99af9d 100644 --- a/llvm/test/MC/ELF/cfi-def-cfa-register.s +++ b/llvm/test/MC/ELF/cfi-def-cfa-register.s @@ -21,7 +21,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -43,5 +42,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-def-cfa.s b/llvm/test/MC/ELF/cfi-def-cfa.s index abde0de4fad..36e147f5a4d 100644 --- a/llvm/test/MC/ELF/cfi-def-cfa.s +++ b/llvm/test/MC/ELF/cfi-def-cfa.s @@ -21,7 +21,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -43,5 +42,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-escape.s b/llvm/test/MC/ELF/cfi-escape.s index a910faba64c..839d6717deb 100644 --- a/llvm/test/MC/ELF/cfi-escape.s +++ b/llvm/test/MC/ELF/cfi-escape.s @@ -22,7 +22,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -44,5 +43,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-offset.s b/llvm/test/MC/ELF/cfi-offset.s index f7f95fbc5f2..951a6001e51 100644 --- a/llvm/test/MC/ELF/cfi-offset.s +++ b/llvm/test/MC/ELF/cfi-offset.s @@ -21,7 +21,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -43,5 +42,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-register.s b/llvm/test/MC/ELF/cfi-register.s index f7a07e45d8b..4abbb53b8fc 100644 --- a/llvm/test/MC/ELF/cfi-register.s +++ b/llvm/test/MC/ELF/cfi-register.s @@ -22,7 +22,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -44,5 +43,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-rel-offset.s b/llvm/test/MC/ELF/cfi-rel-offset.s index 35a73efb0f4..34254c862a4 100644 --- a/llvm/test/MC/ELF/cfi-rel-offset.s +++ b/llvm/test/MC/ELF/cfi-rel-offset.s @@ -29,7 +29,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -52,5 +51,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-rel-offset2.s b/llvm/test/MC/ELF/cfi-rel-offset2.s index 5817d1f4af7..3de769f39fa 100644 --- a/llvm/test/MC/ELF/cfi-rel-offset2.s +++ b/llvm/test/MC/ELF/cfi-rel-offset2.s @@ -21,7 +21,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -43,5 +42,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-remember.s b/llvm/test/MC/ELF/cfi-remember.s index 932a1828eb2..98c759d4fff 100644 --- a/llvm/test/MC/ELF/cfi-remember.s +++ b/llvm/test/MC/ELF/cfi-remember.s @@ -24,7 +24,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -46,5 +45,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-restore.s b/llvm/test/MC/ELF/cfi-restore.s index 6c25d5b4719..d25b5ff2e93 100644 --- a/llvm/test/MC/ELF/cfi-restore.s +++ b/llvm/test/MC/ELF/cfi-restore.s @@ -22,7 +22,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -44,5 +43,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-same-value.s b/llvm/test/MC/ELF/cfi-same-value.s index 075c6b9b843..9f5ae4be9ed 100644 --- a/llvm/test/MC/ELF/cfi-same-value.s +++ b/llvm/test/MC/ELF/cfi-same-value.s @@ -22,7 +22,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -44,5 +43,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-undefined.s b/llvm/test/MC/ELF/cfi-undefined.s index c83b47c142b..9773a36a3b0 100644 --- a/llvm/test/MC/ELF/cfi-undefined.s +++ b/llvm/test/MC/ELF/cfi-undefined.s @@ -22,7 +22,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -44,5 +43,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/cfi-zero-addr-delta.s b/llvm/test/MC/ELF/cfi-zero-addr-delta.s index 4ac0e34f10c..05cb0ae35bd 100644 --- a/llvm/test/MC/ELF/cfi-zero-addr-delta.s +++ b/llvm/test/MC/ELF/cfi-zero-addr-delta.s @@ -28,7 +28,6 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001 @@ -51,4 +50,5 @@ f: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 // CHECK-NEXT: ] diff --git a/llvm/test/MC/ELF/cfi.s b/llvm/test/MC/ELF/cfi.s index 98f4fa9c62e..b8b6e6b52af 100644 --- a/llvm/test/MC/ELF/cfi.s +++ b/llvm/test/MC/ELF/cfi.s @@ -227,78 +227,6 @@ f36: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ -// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 -// CHECK-NEXT: 0x29 R_X86_64_32 bar 0x0 -// CHECK-NEXT: 0x43 R_X86_64_64 foo 0x0 -// CHECK-NEXT: 0x5C R_X86_64_PC32 .text 0x1 -// CHECK-NEXT: 0x65 R_X86_64_32 bar 0x0 -// CHECK-NEXT: 0x74 R_X86_64_PC32 .text 0x2 -// CHECK-NEXT: 0x7D R_X86_64_32 bar 0x0 -// CHECK-NEXT: 0x97 R_X86_64_64 foo 0x0 -// CHECK-NEXT: 0xB0 R_X86_64_PC32 .text 0x3 -// CHECK-NEXT: 0xB9 R_X86_64_16 bar 0x0 -// CHECK-NEXT: 0xCE R_X86_64_16 foo 0x0 -// CHECK-NEXT: 0xE0 R_X86_64_PC32 .text 0x4 -// CHECK-NEXT: 0xFE R_X86_64_32 foo 0x0 -// CHECK-NEXT: 0x110 R_X86_64_PC32 .text 0x5 -// CHECK-NEXT: 0x12E R_X86_64_64 foo 0x0 -// CHECK-NEXT: 0x144 R_X86_64_PC32 .text 0x6 -// CHECK-NEXT: 0x162 R_X86_64_16 foo 0x0 -// CHECK-NEXT: 0x174 R_X86_64_PC32 .text 0x7 -// CHECK-NEXT: 0x192 R_X86_64_32 foo 0x0 -// CHECK-NEXT: 0x1A4 R_X86_64_PC32 .text 0x8 -// CHECK-NEXT: 0x1C2 R_X86_64_64 foo 0x0 -// CHECK-NEXT: 0x1D8 R_X86_64_PC32 .text 0x9 -// CHECK-NEXT: 0x1F6 R_X86_64_64 foo 0x0 -// CHECK-NEXT: 0x20C R_X86_64_PC32 .text 0xA -// CHECK-NEXT: 0x22A R_X86_64_PC64 foo 0x0 -// CHECK-NEXT: 0x240 R_X86_64_PC32 .text 0xB -// CHECK-NEXT: 0x25E R_X86_64_PC16 foo 0x0 -// CHECK-NEXT: 0x270 R_X86_64_PC32 .text 0xC -// CHECK-NEXT: 0x28E R_X86_64_PC32 foo 0x0 -// CHECK-NEXT: 0x2A0 R_X86_64_PC32 .text 0xD -// CHECK-NEXT: 0x2BE R_X86_64_PC64 foo 0x0 -// CHECK-NEXT: 0x2D4 R_X86_64_PC32 .text 0xE -// CHECK-NEXT: 0x2F2 R_X86_64_PC16 foo 0x0 -// CHECK-NEXT: 0x304 R_X86_64_PC32 .text 0xF -// CHECK-NEXT: 0x322 R_X86_64_PC32 foo 0x0 -// CHECK-NEXT: 0x334 R_X86_64_PC32 .text 0x10 -// CHECK-NEXT: 0x352 R_X86_64_PC64 foo 0x0 -// CHECK-NEXT: 0x368 R_X86_64_PC32 .text 0x11 -// CHECK-NEXT: 0x386 R_X86_64_PC64 foo 0x0 -// CHECK-NEXT: 0x39C R_X86_64_PC32 .text 0x12 -// CHECK-NEXT: 0x3BA R_X86_64_64 foo 0x0 -// CHECK-NEXT: 0x3D0 R_X86_64_PC32 .text 0x13 -// CHECK-NEXT: 0x3EE R_X86_64_16 foo 0x0 -// CHECK-NEXT: 0x400 R_X86_64_PC32 .text 0x14 -// CHECK-NEXT: 0x41E R_X86_64_32 foo 0x0 -// CHECK-NEXT: 0x430 R_X86_64_PC32 .text 0x15 -// CHECK-NEXT: 0x44E R_X86_64_64 foo 0x0 -// CHECK-NEXT: 0x464 R_X86_64_PC32 .text 0x16 -// CHECK-NEXT: 0x482 R_X86_64_16 foo 0x0 -// CHECK-NEXT: 0x494 R_X86_64_PC32 .text 0x17 -// CHECK-NEXT: 0x4B2 R_X86_64_32 foo 0x0 -// CHECK-NEXT: 0x4C4 R_X86_64_PC32 .text 0x18 -// CHECK-NEXT: 0x4E2 R_X86_64_64 foo 0x0 -// CHECK-NEXT: 0x4F8 R_X86_64_PC32 .text 0x19 -// CHECK-NEXT: 0x516 R_X86_64_64 foo 0x0 -// CHECK-NEXT: 0x52C R_X86_64_PC32 .text 0x1A -// CHECK-NEXT: 0x54A R_X86_64_PC64 foo 0x0 -// CHECK-NEXT: 0x560 R_X86_64_PC32 .text 0x1B -// CHECK-NEXT: 0x57E R_X86_64_PC16 foo 0x0 -// CHECK-NEXT: 0x590 R_X86_64_PC32 .text 0x1C -// CHECK-NEXT: 0x5AE R_X86_64_PC32 foo 0x0 -// CHECK-NEXT: 0x5C0 R_X86_64_PC32 .text 0x1D -// CHECK-NEXT: 0x5DE R_X86_64_PC64 foo 0x0 -// CHECK-NEXT: 0x5F4 R_X86_64_PC32 .text 0x1E -// CHECK-NEXT: 0x612 R_X86_64_PC16 foo 0x0 -// CHECK-NEXT: 0x624 R_X86_64_PC32 .text 0x1F -// CHECK-NEXT: 0x642 R_X86_64_PC32 foo 0x0 -// CHECK-NEXT: 0x654 R_X86_64_PC32 .text 0x20 -// CHECK-NEXT: 0x672 R_X86_64_PC64 foo 0x0 -// CHECK-NEXT: 0x688 R_X86_64_PC32 .text 0x21 -// CHECK-NEXT: 0x6A6 R_X86_64_PC64 foo 0x0 -// CHECK-NEXT: 0x6BC R_X86_64_PC32 .text 0x22 // CHECK-NEXT: ] // CHECK-NEXT: SectionData ( // CHECK-NEXT: 0000: 14000000 00000000 017A4C52 00017810 @@ -427,5 +355,77 @@ f36: // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x20 R_X86_64_PC32 .text 0x0 +// CHECK-NEXT: 0x29 R_X86_64_32 bar 0x0 +// CHECK-NEXT: 0x43 R_X86_64_64 foo 0x0 +// CHECK-NEXT: 0x5C R_X86_64_PC32 .text 0x1 +// CHECK-NEXT: 0x65 R_X86_64_32 bar 0x0 +// CHECK-NEXT: 0x74 R_X86_64_PC32 .text 0x2 +// CHECK-NEXT: 0x7D R_X86_64_32 bar 0x0 +// CHECK-NEXT: 0x97 R_X86_64_64 foo 0x0 +// CHECK-NEXT: 0xB0 R_X86_64_PC32 .text 0x3 +// CHECK-NEXT: 0xB9 R_X86_64_16 bar 0x0 +// CHECK-NEXT: 0xCE R_X86_64_16 foo 0x0 +// CHECK-NEXT: 0xE0 R_X86_64_PC32 .text 0x4 +// CHECK-NEXT: 0xFE R_X86_64_32 foo 0x0 +// CHECK-NEXT: 0x110 R_X86_64_PC32 .text 0x5 +// CHECK-NEXT: 0x12E R_X86_64_64 foo 0x0 +// CHECK-NEXT: 0x144 R_X86_64_PC32 .text 0x6 +// CHECK-NEXT: 0x162 R_X86_64_16 foo 0x0 +// CHECK-NEXT: 0x174 R_X86_64_PC32 .text 0x7 +// CHECK-NEXT: 0x192 R_X86_64_32 foo 0x0 +// CHECK-NEXT: 0x1A4 R_X86_64_PC32 .text 0x8 +// CHECK-NEXT: 0x1C2 R_X86_64_64 foo 0x0 +// CHECK-NEXT: 0x1D8 R_X86_64_PC32 .text 0x9 +// CHECK-NEXT: 0x1F6 R_X86_64_64 foo 0x0 +// CHECK-NEXT: 0x20C R_X86_64_PC32 .text 0xA +// CHECK-NEXT: 0x22A R_X86_64_PC64 foo 0x0 +// CHECK-NEXT: 0x240 R_X86_64_PC32 .text 0xB +// CHECK-NEXT: 0x25E R_X86_64_PC16 foo 0x0 +// CHECK-NEXT: 0x270 R_X86_64_PC32 .text 0xC +// CHECK-NEXT: 0x28E R_X86_64_PC32 foo 0x0 +// CHECK-NEXT: 0x2A0 R_X86_64_PC32 .text 0xD +// CHECK-NEXT: 0x2BE R_X86_64_PC64 foo 0x0 +// CHECK-NEXT: 0x2D4 R_X86_64_PC32 .text 0xE +// CHECK-NEXT: 0x2F2 R_X86_64_PC16 foo 0x0 +// CHECK-NEXT: 0x304 R_X86_64_PC32 .text 0xF +// CHECK-NEXT: 0x322 R_X86_64_PC32 foo 0x0 +// CHECK-NEXT: 0x334 R_X86_64_PC32 .text 0x10 +// CHECK-NEXT: 0x352 R_X86_64_PC64 foo 0x0 +// CHECK-NEXT: 0x368 R_X86_64_PC32 .text 0x11 +// CHECK-NEXT: 0x386 R_X86_64_PC64 foo 0x0 +// CHECK-NEXT: 0x39C R_X86_64_PC32 .text 0x12 +// CHECK-NEXT: 0x3BA R_X86_64_64 foo 0x0 +// CHECK-NEXT: 0x3D0 R_X86_64_PC32 .text 0x13 +// CHECK-NEXT: 0x3EE R_X86_64_16 foo 0x0 +// CHECK-NEXT: 0x400 R_X86_64_PC32 .text 0x14 +// CHECK-NEXT: 0x41E R_X86_64_32 foo 0x0 +// CHECK-NEXT: 0x430 R_X86_64_PC32 .text 0x15 +// CHECK-NEXT: 0x44E R_X86_64_64 foo 0x0 +// CHECK-NEXT: 0x464 R_X86_64_PC32 .text 0x16 +// CHECK-NEXT: 0x482 R_X86_64_16 foo 0x0 +// CHECK-NEXT: 0x494 R_X86_64_PC32 .text 0x17 +// CHECK-NEXT: 0x4B2 R_X86_64_32 foo 0x0 +// CHECK-NEXT: 0x4C4 R_X86_64_PC32 .text 0x18 +// CHECK-NEXT: 0x4E2 R_X86_64_64 foo 0x0 +// CHECK-NEXT: 0x4F8 R_X86_64_PC32 .text 0x19 +// CHECK-NEXT: 0x516 R_X86_64_64 foo 0x0 +// CHECK-NEXT: 0x52C R_X86_64_PC32 .text 0x1A +// CHECK-NEXT: 0x54A R_X86_64_PC64 foo 0x0 +// CHECK-NEXT: 0x560 R_X86_64_PC32 .text 0x1B +// CHECK-NEXT: 0x57E R_X86_64_PC16 foo 0x0 +// CHECK-NEXT: 0x590 R_X86_64_PC32 .text 0x1C +// CHECK-NEXT: 0x5AE R_X86_64_PC32 foo 0x0 +// CHECK-NEXT: 0x5C0 R_X86_64_PC32 .text 0x1D +// CHECK-NEXT: 0x5DE R_X86_64_PC64 foo 0x0 +// CHECK-NEXT: 0x5F4 R_X86_64_PC32 .text 0x1E +// CHECK-NEXT: 0x612 R_X86_64_PC16 foo 0x0 +// CHECK-NEXT: 0x624 R_X86_64_PC32 .text 0x1F +// CHECK-NEXT: 0x642 R_X86_64_PC32 foo 0x0 +// CHECK-NEXT: 0x654 R_X86_64_PC32 .text 0x20 +// CHECK-NEXT: 0x672 R_X86_64_PC64 foo 0x0 +// CHECK-NEXT: 0x688 R_X86_64_PC32 .text 0x21 +// CHECK-NEXT: 0x6A6 R_X86_64_PC64 foo 0x0 +// CHECK-NEXT: 0x6BC R_X86_64_PC32 .text 0x22 // CHECK-NEXT: ] // CHECK: } diff --git a/llvm/test/MC/ELF/gen-dwarf.s b/llvm/test/MC/ELF/gen-dwarf.s index 907bf424f47..a702bc8610c 100644 --- a/llvm/test/MC/ELF/gen-dwarf.s +++ b/llvm/test/MC/ELF/gen-dwarf.s @@ -15,11 +15,11 @@ foo: .size foo, .-foo // CHECK: Relocations [ -// CHECK: Section ({{[^ ]+}}) .debug_info { +// CHECK: Section ({{[^ ]+}}) .rel.debug_info { // CHECK-NEXT: 0x6 R_386_32 .debug_abbrev 0x0 // CHECK-NEXT: 0xC R_386_32 .debug_line 0x0 // CHECK: } -// CHECK-NEXT: Section ({{[^ ]+}}) .debug_aranges { +// CHECK-NEXT: Section ({{[^ ]+}}) .rel.debug_aranges { // CHECK-NEXT: 0x6 R_386_32 .debug_info 0x0 // CHECK-NEXT: 0x10 R_386_32 .text 0x0 // CHECK-NEXT: } diff --git a/llvm/test/MC/ELF/got.s b/llvm/test/MC/ELF/got.s index 60dea6d3b17..30114b75d84 100644 --- a/llvm/test/MC/ELF/got.s +++ b/llvm/test/MC/ELF/got.s @@ -7,7 +7,7 @@ movl foo@GOTPCREL(%rip), %eax // CHECK: Relocations [ -// CHECK: Section ({{[^ ]+}}) .text { +// CHECK: Section ({{[^ ]+}}) .rela.text { // CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_GOT32 foo 0x{{[^ ]+}} // CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_GOTPCREL foo 0x{{[^ ]+}} // CHECK-NEXT: } diff --git a/llvm/test/MC/ELF/local-reloc.s b/llvm/test/MC/ELF/local-reloc.s index 4241ba5af41..0c745197c81 100644 --- a/llvm/test/MC/ELF/local-reloc.s +++ b/llvm/test/MC/ELF/local-reloc.s @@ -7,7 +7,7 @@ foo: // CHECKT: Relocations [ -// CHECK: Section (1) .text { +// CHECK: Section (2) .rela.text { // CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_32S .text 0x{{[^ ]+}} // CHECK-NEXT: } // CHECK-NEXT: ] diff --git a/llvm/test/MC/ELF/merge.s b/llvm/test/MC/ELF/merge.s index d34635a6710..0e92583192d 100644 --- a/llvm/test/MC/ELF/merge.s +++ b/llvm/test/MC/ELF/merge.s @@ -23,7 +23,7 @@ zed: foo: // CHECK: Relocations [ -// CHECK-NEXT: Section (1) .text { +// CHECK-NEXT: Section (2) .rela.text { // CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_PC32 .Lfoo 0x{{[^ ]+}} // CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_32 .sec1 0x{{[^ ]+}} // CHECK-NEXT: 0x{{[^ ]+}} R_X86_64_32 .Lfoo 0x{{[^ ]+}} diff --git a/llvm/test/MC/ELF/relocation-386.s b/llvm/test/MC/ELF/relocation-386.s index 24d0172e724..9bc831056ae 100644 --- a/llvm/test/MC/ELF/relocation-386.s +++ b/llvm/test/MC/ELF/relocation-386.s @@ -4,7 +4,7 @@ // correctly point to the section or the symbol. // CHECK: Relocations [ -// CHECK-NEXT: Section (1) .text { +// CHECK-NEXT: Section (2) .rel.text { // CHECK-NEXT: 0x2 R_386_GOTOFF .Lfoo 0x0 // CHECK-NEXT: 0x{{[^ ]+}} R_386_PLT32 bar2 0x0 // CHECK-NEXT: 0x{{[^ ]+}} R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 0x0 diff --git a/llvm/test/MC/ELF/relocation-pc.s b/llvm/test/MC/ELF/relocation-pc.s index 551f5ff378e..fc7420c3989 100644 --- a/llvm/test/MC/ELF/relocation-pc.s +++ b/llvm/test/MC/ELF/relocation-pc.s @@ -9,8 +9,6 @@ // CHECK: Index: 1 // CHECK-NEXT: Name: .text // CHECK: Relocations [ -// CHECK-NEXT: 0x1 R_X86_64_PC8 - 0x0 -// CHECK-NEXT: 0x3 R_X86_64_PC32 - 0x0 // CHECK-NEXT: ] // CHECK-NEXT: } @@ -28,5 +26,7 @@ // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: 0x1 R_X86_64_PC8 - 0x0 +// CHECK-NEXT: 0x3 R_X86_64_PC32 - 0x0 // CHECK-NEXT: ] // CHECK-NEXT: } diff --git a/llvm/test/MC/ELF/relocation.s b/llvm/test/MC/ELF/relocation.s index 19bcc18d8f8..18d43dab763 100644 --- a/llvm/test/MC/ELF/relocation.s +++ b/llvm/test/MC/ELF/relocation.s @@ -21,7 +21,7 @@ bar: // CHECK: Section { -// CHECK: Name: .text +// CHECK: Name: .rela.text // CHECK: Relocations [ // CHECK-NEXT: 0x1 R_X86_64_32 .text // CHECK-NEXT: 0x8 R_X86_64_32S .text diff --git a/llvm/test/MC/ELF/rename.s b/llvm/test/MC/ELF/rename.s index c50910b41ec..5364dde9f46 100644 --- a/llvm/test/MC/ELF/rename.s +++ b/llvm/test/MC/ELF/rename.s @@ -32,10 +32,27 @@ defined3: // CHECK-NEXT: AddressAlignment: 4 // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: Relocations [ +// CHECK-NEXT: ] +// CHECK-NEXT: } +// CHECK-NEXT: Section { +// CHECK-NEXT: Index: 2 +// CHECK-NEXT: Name: .rela.text (1) +// CHECK-NEXT: Type: SHT_RELA (0x4) +// CHECK-NEXT: Flags [ (0x0) +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x0 +// CHECK-NEXT: Offset: 0x320 +// CHECK-NEXT: Size: 24 +// CHECK-NEXT: Link: 6 +// CHECK-NEXT: Info: 1 +// CHECK-NEXT: AddressAlignment: 8 +// CHECK-NEXT: EntrySize: 24 +// CHECK-NEXT: Relocations [ // CHECK-NEXT: 0x0 R_X86_64_32 .text 0x0 // CHECK-NEXT: ] // CHECK-NEXT: } + // Symbol 2 is section 1 // CHECK: Symbol { // CHECK: Name: .text (0) diff --git a/llvm/test/MC/ELF/symref.s b/llvm/test/MC/ELF/symref.s index 9a71a81930e..c8015b96a31 100644 --- a/llvm/test/MC/ELF/symref.s +++ b/llvm/test/MC/ELF/symref.s @@ -22,7 +22,7 @@ defined3: global1: // CHECK: Relocations [ -// CHECK-NEXT: Section (1) .text { +// CHECK-NEXT: Section (2) .rela.text { // CHECK-NEXT: 0x0 R_X86_64_32 .text 0x0 // CHECK-NEXT: 0x4 R_X86_64_32 bar2@zed 0x0 // CHECK-NEXT: 0x8 R_X86_64_32 .text 0x0 diff --git a/llvm/test/MC/ELF/weak-relocation.s b/llvm/test/MC/ELF/weak-relocation.s index 0f5bba2383d..19153aa50da 100644 --- a/llvm/test/MC/ELF/weak-relocation.s +++ b/llvm/test/MC/ELF/weak-relocation.s @@ -8,7 +8,7 @@ bar: call foo // CHECK: Relocations [ -// CHECK-NEXT: Section ({{[0-9]+}}) .text { +// CHECK-NEXT: Section ({{[0-9]+}}) .rela.text { // CHECK-NEXT: 0x1 R_X86_64_PC32 foo 0xFFFFFFFFFFFFFFFC // CHECK-NEXT: } // CHECK-NEXT: ] diff --git a/llvm/test/MC/ELF/x86_64-reloc-sizetest.s b/llvm/test/MC/ELF/x86_64-reloc-sizetest.s index bd67ee0f9de..10c13123e65 100644 --- a/llvm/test/MC/ELF/x86_64-reloc-sizetest.s +++ b/llvm/test/MC/ELF/x86_64-reloc-sizetest.s @@ -7,7 +7,7 @@ L: movq $(L + 2147483648),%rax // CHECK: Relocations [ -// CHECK-NEXT: Section ({{[0-9]+}}) .text { +// CHECK-NEXT: Section ({{[0-9]+}}) .rela.text { // CHECK-NEXT: 0x3 R_X86_64_32S {{[^ ]+}} 0x80000000 // CHECK-NEXT: } // CHECK-NEXT: ] |