55 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o3# RUN: llvm-readobj -r %t.o | FileCheck %s --check-prefix=OBJ4# RUN: ld.lld %t.o -o %t -pie5# RUN: llvm-objdump --no-print-imm-hex -s --section=.foobar --section=.got -r -d -t \6# RUN: --dynamic-reloc %t | FileCheck %s --check-prefixes=CHECK,REL7# RUN: ld.lld %t.o -o %t-rela -pie -z rela8# RUN: llvm-objdump --no-print-imm-hex -s --section=.foobar --section=.got -r -d -t \9# RUN: --dynamic-reloc %t-rela | FileCheck %s --check-prefixes=CHECK,RELA10 11# Unlike bfd and gold we accept this.12 13# OBJ: Relocations [14# OBJ-NEXT: Section (4) .rel.foobar {15# OBJ-NEXT: 0x2 R_386_GOT32 foo16# OBJ-NEXT: }17# OBJ-NEXT: ]18 19# CHECK-LABEL: SYMBOL TABLE:20# REL: 00001180 l .text 00000000 foo21# REL: 00002180 g .foobar 00000000 _start22# RELA: 00001188 l .text 00000000 foo23# RELA: 00002188 g .foobar 00000000 _start24 25# CHECK-LABEL: DYNAMIC RELOCATION RECORDS26# CHECK-NEXT: OFFSET TYPE VALUE27# REL-NEXT: 00002182 R_386_RELATIVE *ABS*{{$}}28# REL-NEXT: 000031f0 R_386_RELATIVE *ABS*{{$}}29# RELA-NEXT: 0000218a R_386_RELATIVE *ABS*+0x31f8{{$}}30# RELA-NEXT: 000031f8 R_386_RELATIVE *ABS*+0x1188{{$}}31# CHECK-NEXT: Contents of section .foobar:32# REL-NEXT: 2180 8b1df031 000033## ^--- VA of GOT entry (0x31f0)34# RELA-NEXT: 2188 8b1d0000 000035## ^--- VA of GOT entry in Elf_Rela addend36# CHECK-NEXT: Contents of section .got:37# REL-NEXT: 31f0 8011000038## ^--- VA of foo (0x1180)39# RELA-NEXT: 31f8 0000000040## ^--- VA of foo in Elf_Rela addend41 42# CHECK-LABEL: Disassembly of section .foobar:43# CHECK: <_start>:44# REL-NEXT: 2180: 8b 1d f0 31 00 00 movl 12784, %ebx45## ^--- VA of GOT entry (0x31f0)46# RELA-NEXT: 2188: 8b 1d 00 00 00 00 movl 0, %ebx47## ^--- VA of GOT entry in in Elf_Rela addend48 49foo:50 51.section .foobar, "awx"52.global _start53_start:54 movl foo@GOT, %ebx55