brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 8d77766 Raw
83 lines · plain
1# REQUIRES: x862# RUN: rm -rf %t && split-file %s %t && cd %t3# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o4# RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o5# RUN: llvm-mc -filetype=obj -triple=x86_64 c.s -o c.o6# RUN: llvm-mc -filetype=obj -triple=x86_64 %S/Inputs/shared.s -o s.o7# RUN: ld.lld -shared s.o -o s.so8 9# RUN: ld.lld a.o -o a --export-dynamic10# RUN: llvm-readelf -r --hex-dump=.data a | FileCheck %s --check-prefix=STATIC11# RUN: ld.lld a.o s.so -o as12# RUN: llvm-readelf -r --hex-dump=.data as | FileCheck %s --check-prefix=STATIC13# RUN: ld.lld a.o -o a.pie -pie14# RUN: llvm-readelf -r --hex-dump=.data a.pie | FileCheck %s --check-prefix=STATIC15# RUN: ld.lld a.o -o a.so -shared16# RUN: llvm-readelf -r a.so | FileCheck %s --check-prefix=DYN17 18## gABI leaves the behavior of weak undefined references implementation defined.19## We choose to resolve them statically for static linking and produce dynamic relocations20## for dynamic linking (-shared or at least one input DSO).21 22## -z dynamic-undefined-weak is ignored if .dynsym is absent (-no-pie without DSO)23# RUN: ld.lld a.o -o a.d -z dynamic-undefined-weak 2>&1 | count 024# RUN: llvm-readelf -r --hex-dump=.data a.d | FileCheck %s --check-prefix=STATIC25 26## Currently no effect for S+A relocations.27# RUN: ld.lld a.o s.so -o as.d -z dynamic-undefined-weak28# RUN: llvm-readelf -r --hex-dump=.data as.d | FileCheck %s --check-prefix=STATIC29 30## -z dynamic-undefined-weak forces dynamic relocations if .dynsym is present.31# RUN: ld.lld a.o -o a.pie.d -pie -z dynamic-undefined-weak32# RUN: llvm-readelf -r a.pie.d | FileCheck %s --check-prefix=DYN33 34## -z nodynamic-undefined-weak suppresses dynamic relocations.35# RUN: ld.lld a.o -o a.so.n -shared -z dynamic-undefined-weak -z nodynamic-undefined-weak36# RUN: llvm-readelf -r --hex-dump=.data a.so.n | FileCheck %s --check-prefix=STATIC37 38# STATIC:      no relocations39# STATIC:      Hex dump of section '.data':40# STATIC-NEXT: {{.*}} 00000000 00000000 03000000 00000000 .41# STATIC-EMPTY:42 43# DYN:        Relocation section '.rela.dyn' {{.*}} contains 244# DYN:        R_X86_64_64 0000000000000000 foobar + 0{{$}}45 46# RUN: ld.lld a.o b.o -o ab -z undefs47# RUN: llvm-readelf -r -x .data ab | FileCheck %s --check-prefix=STATIC148# RUN: ld.lld a.o b.o s.so -o abs -z undefs49# RUN: llvm-readelf -r -x .data abs | FileCheck %s --check-prefix=STATIC150# RUN: ld.lld a.o b.o -o ab.pie -pie -z undefs51# RUN: llvm-readelf -r -x .data ab.pie | FileCheck %s --check-prefix=STATIC152# RUN: ld.lld a.o b.o s.so -o abs.pie -pie -z undefs53# RUN: llvm-readelf -r -x .data abs.pie | FileCheck %s --check-prefix=DYN154 55# STATIC1:      no relocations56# STATIC1:      Hex dump of section '.data':57# STATIC1-NEXT: {{.*}} 00000000 00000000 03000000 00000000 .58# STATIC1-NEXT: {{.*}} 05000000 00000000                   .59# STATIC1-EMPTY:60 61# DYN1:        Relocation section '.rela.dyn' {{.*}} contains 362# DYN1:        Hex dump of section '.data':63# DYN1-NEXT:   {{.*}} 00000000 00000000 00000000 00000000 .64# DYN1-NEXT:   {{.*}} 00000000 00000000                   .65# DYN1-EMPTY:66 67# RUN: ld.lld a.o b.o c.o -pie -z undefs 2>&1 | count 068 69#--- a.s70.global _start71_start:72.data73.weak foobar74.quad foobar75.quad foobar+376 77#--- b.s78.data79.quad undef+580 81#--- c.s82call undef83