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 %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 19# PIC: .rela.dyn { 20# PIC-NEXT: R_X86_64_64 foobar 0x0 21# PIC-NEXT: } 22 23 .global _start 24_start: 25 .data 26 .weak foobar 27 .quad foobar 28