xref: /llvm-project/lld/test/ELF/relocation-undefined-weak.s (revision aaeba6483fdafa442b950427bfa3e6443034f78d)
1# REQUIRES: x86
2
3## On some targets (e.g. ARM, AArch64, and PPC), PC relative relocations to
4## weak undefined symbols resolve to special positions. On many others
5## the target symbols as treated as VA 0. Absolute relocations are always
6## resolved as VA 0.
7
8# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
9# RUN: ld.lld %t.o -o %t
10
11# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t | FileCheck %s --check-prefix=TEXT
12# TEXT: 201158: movl $0x1, -0x201162(%rip)
13
14# RUN: llvm-readelf -r --hex-dump=.data %t | FileCheck %s --check-prefix=DATA
15# DATA: Hex dump of section '.data':
16# DATA-NEXT: {{.*}} 00000000 00000000
17# DATA-EMPTY:
18
19# RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=NORELCS
20# NORELCS: no relocations
21
22.global _start
23_start:
24  movl $1, sym1(%rip)
25
26.data
27.weak sym1
28.quad sym1
29