|
1 | 1 | # REQUIRES: x86
|
2 |
| -# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o |
3 |
| -# RUN: ld.lld -r %t1.o -o %t2.o |
4 |
| -# RUN: llvm-readobj -r %t2.o | FileCheck %s |
| 2 | +## Test relocations referencing non-STT_SECTION local symbols in SHF_ALLOC and non-SHF_ALLOC sections for -r. |
5 | 3 |
|
6 |
| -# CHECK: Relocations [ |
7 |
| -# CHECK-NEXT: Section ({{.*}}) .rela.text { |
8 |
| -# CHECK-NEXT: 0x3 R_X86_64_PC32 .Lstr 0xFFFFFFFFFFFFFFFC |
9 |
| -# CHECK-NEXT: } |
10 |
| -# CHECK-NEXT: ] |
| 4 | +# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o |
| 5 | +# RUN: ld.lld -r -o %t %t.o %t.o |
| 6 | +# RUN: llvm-readelf -r -x .nonalloc %t | FileCheck --check-prefix=RELA %s |
11 | 7 |
|
12 |
| - leaq .Lstr(%rip), %rdi |
| 8 | +# RUN: llvm-mc -filetype=obj -triple=i686 --defsym X86_32=1 %s -o %t1.o |
| 9 | +# RUN: ld.lld -r -o %t1 %t1.o %t1.o |
| 10 | +# RUN: llvm-readelf -r -x .nonalloc %t1 | FileCheck --check-prefix=REL %s |
13 | 11 |
|
14 |
| - .section .rodata.str1.1,"aMS",@progbits,1 |
15 |
| - .Lstr: |
16 |
| - .asciz "abc\n" |
| 12 | +# RELA: Relocation section '.rela.data' at offset {{.*}} contains 2 entries: |
| 13 | +# RELA: Offset Info Type Symbol's Value Symbol's Name + Addend |
| 14 | +# RELA-NEXT: 0000000000000000 {{.*}} R_X86_64_32 0000000000000000 ifunc + 9 |
| 15 | +# RELA-NEXT: 0000000000000004 {{.*}} R_X86_64_32 0000000000000004 ifunc + 9 |
| 16 | +# RELA: Relocation section '.rela.nonalloc' at offset {{.*}} contains 2 entries: |
| 17 | +# RELA: Offset Info Type Symbol's Value Symbol's Name + Addend |
| 18 | +# RELA-NEXT: 0000000000000000 {{.*}} R_X86_64_32 0000000000000000 ifunc + 9 |
| 19 | +# RELA-NEXT: 0000000000000004 {{.*}} R_X86_64_32 0000000000000004 ifunc + 9 |
| 20 | +# RELA: Hex dump of section '.nonalloc': |
| 21 | +# RELA-NEXT: 0x00000000 00000000 00000000 ........ |
| 22 | + |
| 23 | +# REL: Offset Info Type Sym. Value Symbol's Name |
| 24 | +# REL-NEXT: 00000000 {{.*}} R_386_32 00000000 ifunc |
| 25 | +# REL-NEXT: 00000004 {{.*}} R_386_32 00000004 ifunc |
| 26 | +# REL-EMPTY: |
| 27 | +# REL: Offset Info Type Sym. Value Symbol's Name |
| 28 | +# REL-NEXT: 00000000 {{.*}} R_386_32 00000000 ifunc |
| 29 | +# REL-NEXT: 00000004 {{.*}} R_386_32 00000004 ifunc |
| 30 | +# REL: Hex dump of section '.nonalloc': |
| 31 | +# REL-NEXT: 0x00000000 09000000 09000000 ........ |
| 32 | + |
| 33 | +resolver: ret |
| 34 | +.type ifunc, @gnu_indirect_function |
| 35 | +.set ifunc, resolver |
| 36 | + |
| 37 | +.data |
| 38 | +.long ifunc+9 |
| 39 | + |
| 40 | +.section .nonalloc |
| 41 | +## The relocation references ifunc instead of the STT_SECTION symbol. |
| 42 | +.long ifunc+9 |
0 commit comments