1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o 3# RUN: ld.lld %t.o -o %t --export-dynamic 4# RUN: llvm-readelf -r --hex-dump=.data %t | FileCheck %s --check-prefix=NOPIC 5# RUN: ld.lld %t.o -o %t.pie -pie 6# RUN: llvm-readobj -r %t.pie | FileCheck %s --check-prefix=PIC 7# RUN: ld.lld %t.o -o %t.so -shared 8# RUN: llvm-readobj -r %t.so | FileCheck %s --check-prefix=PIC 9 10## gABI leaves the behavior of weak undefined references implementation defined. 11## We choose to resolve them statically for -no-pie and produce dynamic relocations 12## for -pie and -shared. 13## 14## Note: Some ports of GNU ld support -z nodynamic-undefined-weak that we don't 15## implement. 16 17# NOPIC: no relocations 18# NOPIC: Hex dump of section '.data': 19# NOPIC-NEXT: {{.*}} 00000000 00000000 20# NOPIC-EMPTY: 21 22# PIC: .rela.dyn { 23# PIC-NEXT: R_X86_64_64 foobar 0x0 24# PIC-NEXT: } 25 26 .global _start 27_start: 28 .data 29 .weak foobar 30 .quad foobar 31