summaryrefslogtreecommitdiffstats
path: root/lld/test/ELF/relocation-undefined-weak.s
blob: f1cb706329a47d1bf97d6c611d8428f0328c6ac3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
// RUN: ld.lld %t -o %tout
// RUN: llvm-readobj -sections %tout | FileCheck %s
// RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix DISASM
// REQUIRES: x86

// Check that undefined weak symbols are treated as having a VA of 0.

.global _start
_start:
  movl $1, sym1(%rip)

.weak sym1

// CHECK:      Name: .text
// CHECK-NEXT: Type: SHT_PROGBITS
// CHECK-NEXT: Flags [
// CHECK-NEXT:   SHF_ALLOC
// CHECK-NEXT:   SHF_EXECINSTR
// CHECK-NEXT: ]
// CHECK-NEXT: Address: 0x11000

// Unfortunately FileCheck can't do math, so we have to check for explicit
// values:
// R_86_64_PC32 = 0 + (-8 - (0x11000 + 2)) = -69642

// DISASM: movl    $1, -69642(%rip)
OpenPOWER on IntegriCloud