1// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t 2// RUN: ld.lld %t -o %tout 3// RUN: llvm-readobj -sections %tout | FileCheck %s 4// RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix DISASM 5// REQUIRES: x86 6 7// Check that undefined weak symbols are treated as having a VA of 0. 8 9.global _start 10_start: 11 movl $1, sym1(%rip) 12 13.weak sym1 14 15// CHECK: Name: .text 16// CHECK-NEXT: Type: SHT_PROGBITS 17// CHECK-NEXT: Flags [ 18// CHECK-NEXT: SHF_ALLOC 19// CHECK-NEXT: SHF_EXECINSTR 20// CHECK-NEXT: ] 21// CHECK-NEXT: Address: 0x201000 22 23// Unfortunately FileCheck can't do math, so we have to check for explicit 24// values: 25// R_86_64_PC32 = 0 + (-8 - (0x201000 + 2)) = -2101258 26 27// DISASM: movl $1, -2101258(%rip) 28