78 lines · plain
1# REQUIRES: x862## The i386 psABI uses Elf64_Rela relocation entries. We produce3## 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.o6# RUN: ld.lld -shared %t.o -o %t.so --noinhibit-exec7# RUN: llvm-readobj -d -r -x .data -x .got.plt %t.so | FileCheck --check-prefix=REL %s8# RUN: ld.lld -shared -z rel %t.o -o %t1.so9# RUN: llvm-readobj -d -r -x .data -x .got.plt %t1.so | FileCheck --check-prefix=REL %s10 11# REL: REL {{.*}}12# REL-NEXT: RELSZ 32 (bytes)13# REL-NEXT: RELENT 8 (bytes)14# REL-NEXT: RELCOUNT 115# 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 -21# REL-NEXT: R_386_GLOB_DAT func22# REL-NEXT: R_386_TLS_TPOFF tls23# REL-NEXT: R_386_32 _start24# REL-NEXT: }25# REL-NEXT: .rel.plt {26# REL-NEXT: R_386_JUMP_SLOT func27# REL-NEXT: }28 29# REL-LABEL: Hex dump of section '.data':30# REL-NEXT: 0x000042d0 d0420000 2a00000031## ^--- R_386_RELATIVE addend (0x42d0)32## ^--- R_386_32 addend (0x2a)33# REL-LABEL: Hex dump of section '.got.plt':34# REL-NEXT: 0x000042d8 48320000 00000000 00000000 3612000035## R_386_JUMP_SLOT target (0x1236) ---------------^36 37# RUN: ld.lld -shared -z rel -z rela %t.o -o %t2.so38# RUN: llvm-readobj -d -r -x .data -x .got.plt %t2.so | FileCheck --check-prefix=RELA %s39 40# RELA: RELA {{.*}}41# RELA-NEXT: RELASZ 48 (bytes)42# RELA-NEXT: RELAENT 12 (bytes)43# RELA-NEXT: RELACOUNT 144# RELA-NEXT: JMPREL {{.*}}45# RELA-NEXT: PLTRELSZ 12 (bytes)46# RELA-NEXT: PLTGOT {{.*}}47# RELA-NEXT: PLTREL RELA48# RELA: .rela.dyn {49# RELA-NEXT: R_386_RELATIVE - 0x42F050# RELA-NEXT: R_386_GLOB_DAT func 0x051# RELA-NEXT: R_386_TLS_TPOFF tls 0x052# RELA-NEXT: R_386_32 _start 0x2A53# RELA-NEXT: }54# RELA-NEXT: .rela.plt {55# RELA-NEXT: R_386_JUMP_SLOT func 0x056# RELA-NEXT: }57 58# RELA-LABEL: Hex dump of section '.data':59# RELA-NEXT: 0x000042f0 00000000 2a00000060## ^--- R_386_32 addend (0x2a)61## TODO: we should probably clear the R_386_32 addend that was copied from the .o?62## no addend written for R_386_RELATIVE63# RELA-LABEL: Hex dump of section '.got.plt':64# RELA-NEXT: 0x000042f8 68320000 00000000 00000000 5612000065## R_386_JUMP_SLOT target (0x1256) ----------------^66 67.globl _start68_start:69 call func@PLT70 movl func@GOT(%eax), %eax71 72.section .text1,"awx"73 movl tls@GOTNTPOFF(%eax), %eax74 75.data76 .long .data77 .long _start+4278