92 lines · plain
1# REQUIRES: systemz2## Test R_390_GOTENT optimization.3 4# RUN: llvm-mc -filetype=obj -triple=s390x-unknown-linux %s -o %t.o5# RUN: ld.lld %t.o -o %t1 --no-apply-dynamic-relocs6# RUN: llvm-readelf -S -r -x .got.plt %t1 | FileCheck --check-prefixes=CHECK,NOAPPLY %s7# RUN: ld.lld %t.o -o %t1 --apply-dynamic-relocs8# RUN: llvm-readelf -S -r -x .got.plt %t1 | FileCheck --check-prefixes=CHECK,APPLY %s9# RUN: ld.lld %t.o -o %t110# RUN: llvm-objdump --no-print-imm-hex -d %t1 | FileCheck --check-prefix=DISASM %s11 12## --no-relax disables GOT optimization.13# RUN: ld.lld --no-relax %t.o -o %t214# RUN: llvm-objdump --no-print-imm-hex -d %t2 | FileCheck --check-prefix=NORELAX %s15 16## In our implementation, .got is retained even if all GOT-generating relocations are optimized.17# CHECK: Name Type Address Off Size ES Flg Lk Inf Al18# CHECK: .iplt PROGBITS 0000000001001240 000240 000020 00 AX 0 0 1619# CHECK-NEXT: .got PROGBITS 0000000001002260 000260 000018 00 WA 0 0 820# CHECK-NEXT: .relro_padding NOBITS 0000000001002278 000278 000d88 00 WA 0 0 121# CHECK-NEXT: .got.plt PROGBITS 0000000001003278 000278 000008 00 WA 0 0 822 23## There is one R_S390_IRELATIVE relocation.24# CHECK-LABEL: Relocation section '.rela.dyn' at offset {{.*}} contains 1 entries:25# CHECK: 0000000001003278 000000000000003d R_390_IRELATIVE 10011e826 27# CHECK-LABEL: Hex dump of section '.got.plt':28# NOAPPLY-NEXT: 0x01003278 00000000 0000000029# APPLY-NEXT: 0x01003278 00000000 010011e830 31# DISASM: Disassembly of section .text:32# DISASM: 00000000010011e0 <foo>:33# DISASM-NEXT: nop34# DISASM: 00000000010011e4 <hid>:35# DISASM-NEXT: nop36# DISASM: 00000000010011e8 <ifunc>:37# DISASM-NEXT: br %r1438# DISASM: 00000000010011ea <_start>:39# DISASM-NEXT: larl %r1, 0x10011e040# DISASM-NEXT: larl %r1, 0x10011e041# DISASM-NEXT: larl %r1, 0x10011e442# DISASM-NEXT: larl %r1, 0x10011e443# DISASM-NEXT: lgrl %r1, 0x100327844# DISASM-NEXT: lgrl %r1, 0x100327845# DISASM-NEXT: larl %r1, 0x10011e046# DISASM-NEXT: larl %r1, 0x10011e047# DISASM-NEXT: larl %r1, 0x10011e448# DISASM-NEXT: larl %r1, 0x10011e449# DISASM-NEXT: lgrl %r1, 0x100327850# DISASM-NEXT: lgrl %r1, 0x100327851 52# NORELAX-LABEL: <_start>:53# NORELAX-COUNT-12: lgrl54 55.text56.globl foo57 58.text59.globl foo60.type foo, @function61foo:62 nop63 64.globl hid65.hidden hid66.type hid, @function67hid:68 nop69 70.text71.type ifunc STT_GNU_IFUNC72.globl ifunc73.type ifunc, @function74ifunc:75 br %r1476 77.globl _start78.type _start, @function79_start:80 lgrl %r1, foo@GOT81 lgrl %r1, foo@GOT82 lgrl %r1, hid@GOT83 lgrl %r1, hid@GOT84 lgrl %r1, ifunc@GOT85 lgrl %r1, ifunc@GOT86 lgrl %r1, foo@GOT87 lgrl %r1, foo@GOT88 lgrl %r1, hid@GOT89 lgrl %r1, hid@GOT90 lgrl %r1, ifunc@GOT91 lgrl %r1, ifunc@GOT92