1# REQUIRES: x86 2## The i386 psABI uses Elf64_Rela relocation entries. We produce 3## Elf32_Rel dynamic relocations by default, but can use Elf32_Rela with -z rela. 4 5# RUN: llvm-mc -filetype=obj -triple=i386 %s -o %t.o 6# RUN: ld.lld -shared %t.o -o %t.so 7# RUN: llvm-readobj -d -r -x .data %t.so | FileCheck --check-prefix=REL %s 8# RUN: ld.lld -shared -z rel %t.o -o %t1.so 9# RUN: llvm-readobj -d -r -x .data %t1.so | FileCheck --check-prefix=REL %s 10 11# REL: REL {{.*}} 12# REL-NEXT: RELSZ 32 (bytes) 13# REL-NEXT: RELENT 8 (bytes) 14# REL-NEXT: RELCOUNT 1 15# REL-NEXT: JMPREL {{.*}} 16# REL-NEXT: PLTRELSZ 8 (bytes) 17# REL-NEXT: PLTGOT {{.*}} 18# REL-NEXT: PLTREL REL{{$}} 19# REL: .rel.dyn { 20# REL-NEXT: R_386_RELATIVE - 0x0 21# REL-NEXT: R_386_GLOB_DAT func 0x0 22# REL-NEXT: R_386_TLS_TPOFF tls 0x0 23# REL-NEXT: R_386_32 _start 0x0 24# REL-NEXT: } 25# REL-NEXT: .rel.plt { 26# REL-NEXT: R_386_JUMP_SLOT func 0x0 27# REL-NEXT: } 28 29# REL: Hex dump of section '.data': 30# REL-NEXT: 0x000042cc cc420000 2a000000 31 32# RUN: ld.lld -shared -z rel -z rela %t.o -o %t2.so 33# RUN: llvm-readobj -d -r %t2.so | FileCheck --check-prefix=RELA %s 34 35# RELA: RELA {{.*}} 36# RELA-NEXT: RELASZ 48 (bytes) 37# RELA-NEXT: RELAENT 12 (bytes) 38# RELA-NEXT: RELACOUNT 1 39# RELA-NEXT: JMPREL {{.*}} 40# RELA-NEXT: PLTRELSZ 12 (bytes) 41# RELA-NEXT: PLTGOT {{.*}} 42# RELA-NEXT: PLTREL RELA 43# RELA: .rela.dyn { 44# RELA-NEXT: R_386_RELATIVE - 0x42EC 45# RELA-NEXT: R_386_GLOB_DAT func 0x0 46# RELA-NEXT: R_386_TLS_TPOFF tls 0x2A 47# RELA-NEXT: R_386_32 _start 0x2A 48# RELA-NEXT: } 49# RELA-NEXT: .rela.plt { 50# RELA-NEXT: R_386_JUMP_SLOT func 0x0 51# RELA-NEXT: } 52 53.globl _start 54_start: 55 call func@PLT 56 movl func@GOT(%eax), %eax 57 58.section .text1,"awx" 59 movl %gs:tls@NTPOFF+42, %eax 60 61.data 62 .long .data 63 .long _start+42 64