brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · 717343c Raw
84 lines · plain
1# REQUIRES: systemz2# RUN: echo '.globl bar, weak; .type bar,@function; .type weak,@function; bar: weak:' > %t1.s3 4# RUN: llvm-mc -filetype=obj -triple=s390x-unknown-linux %t1.s -o %t1.o5# RUN: ld.lld -shared %t1.o -soname=t1.so -o %t1.so6# RUN: llvm-mc -filetype=obj -triple=s390x-unknown-linux %s -o %t.o7# RUN: ld.lld %t.o %t1.so -z separate-code -o %t8# RUN: llvm-readelf -S -s -r -x .got.plt %t | FileCheck %s9# RUN: llvm-objdump -d %t | FileCheck --check-prefixes=DIS %s10 11# CHECK: Section Headers:12# CHECK: .plt     PROGBITS 0000000001001020 001020 000060 00  AX  0   0 1613# CHECK: .got     PROGBITS 00000000010020d0 0020d0 000018 00  WA  0   0  814# CHECK: .got.plt PROGBITS 00000000010030e8 0020e8 000010 00  WA  0   0  815 16# CHECK: Relocation section '.rela.plt' at offset {{.*}} contains 2 entries:17# CHECK: 00000000010030e8 000000010000000b R_390_JMP_SLOT 0000000000000000 bar + 018# CHECK: 00000000010030f0 000000020000000b R_390_JMP_SLOT 0000000000000000 weak + 019 20## A canonical PLT has a non-zero st_value. bar and weak are called but their21## addresses are not taken, so a canonical PLT is not necessary.22# CHECK: Symbol table '.dynsym' contains 3 entries:23# CHECK-NEXT:   Num:    Value          Size Type    Bind   Vis       Ndx Name24# CHECK-NEXT:     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT   UND25# CHECK-NEXT:     1: 0000000000000000     0 FUNC    GLOBAL DEFAULT   UND bar26# CHECK-NEXT:     2: 0000000000000000     0 FUNC    WEAK   DEFAULT   UND weak27 28## The .got.plt slots relocated by .rela.plt point to .plt29## This is required by glibc.30# CHECK: Hex dump of section '.got.plt':31# CHECK-NEXT: 0x010030e8 00000000 0100104e 00000000 0100106e32 33# DIS: Disassembly of section .text:34 35# DIS: 0000000001001000 <_start>:36# DIS-NEXT: brasl	%r14, 0x100101237# DIS-NEXT: brasl	%r14, 0x100104038# DIS-NEXT: brasl	%r14, 0x100106039 40# DIS: 0000000001001012 <foo>:41# DIS-NEXT: br	%r1442 43# DIS: Disassembly of section .plt:44 45# DIS: 0000000001001020 <.plt>:46# DIS-NEXT: 1001020: e3 10 f0 38 00 24    	stg	%r1, 56(%r15)47# DIS-NEXT: 1001026: c0 10 00 00 08 55          larl	%r1, 0x10020d048# DIS-NEXT: 100102c: d2 07 f0 30 10 08    	mvc	48(8,%r15), 8(%r1)49# DIS-NEXT: 1001032: e3 10 10 10 00 04    	lg	%r1, 16(%r1)50# DIS-NEXT: 1001038: 07 f1        	br	%r151# DIS-NEXT: 100103a: 07 00        	nopr52# DIS-NEXT: 100103c: 07 00        	nopr53# DIS-NEXT: 100103e: 07 00        	nopr54# DIS-NEXT: 1001040: c0 10 00 00 10 54    	larl	%r1, 0x10030e855# DIS-NEXT: 1001046: e3 10 10 00 00 04    	lg	%r1, 0(%r1)56# DIS-NEXT: 100104c: 07 f1        	br	%r157# DIS-NEXT: 100104e: 0d 10        	basr	%r1, 058# DIS-NEXT: 1001050: e3 10 10 0c 00 14    	lgf	%r1, 12(%r1)59# DIS-NEXT: 1001056: c0 f4 ff ff ff e5    	jg	0x100102060# DIS-NEXT: 100105c: 00 00        	<unknown>61# DIS-NEXT: 100105e: 00 00        	<unknown>62# DIS-NEXT: 1001060: c0 10 00 00 10 48    	larl	%r1, 0x10030f063# DIS-NEXT: 1001066: e3 10 10 00 00 04    	lg	%r1, 0(%r1)64# DIS-NEXT: 100106c: 07 f1        	br	%r165# DIS-NEXT: 100106e: 0d 10        	basr	%r1, 066# DIS-NEXT: 1001070: e3 10 10 0c 00 14    	lgf	%r1, 12(%r1)67# DIS-NEXT: 1001076: c0 f4 ff ff ff d5    	jg	0x100102068# DIS-NEXT: 100107c: 00 00        	<unknown>69# DIS-NEXT: 100107e: 00 18        	<unknown>70 71.global _start, foo, bar72.weak weak73 74_start:75  ## Use @plt to avoid generating direct references that would force76  ## allocation of a canonical PLT entry.77  brasl %r14, foo@plt78  brasl %r14, bar@plt79  brasl %r14, weak@plt80 81## foo is local and non-preemptable, no PLT is generated.82foo:83  br %r1484