1// REQUIRES: x86
2// RUN: llvm-mc %s -o %t.o -triple i386-pc-linux-code16 -filetype=obj
3
4// RUN: echo ".global foo; foo = 0x10202" > %t1.s
5// RUN: llvm-mc %t1.s -o %t1.o -triple i386-pc-linux -filetype=obj
6// RUN: echo ".global foo; foo = 0x10203" > %t2.s
7// RUN: llvm-mc %t2.s -o %t2.o -triple i386-pc-linux -filetype=obj
8
9// RUN: ld.lld -Ttext 0x200 %t.o %t1.o -o %t1
10// RUN: llvm-objdump -d --no-show-raw-insn --triple=i386-pc-linux-code16 %t1 | FileCheck %s
11
12// CHECK:        Disassembly of section .text:
13// CHECK-EMPTY:
14// CHECK-NEXT: <_start>:
15// CHECK-NEXT:      200:       jmp 0x202
16//              0x10202 - 0x203 == 0xffff
17
18// RUN: not ld.lld -Ttext 0x200 %t.o %t2.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
19
20// ERR: {{.*}}:(.text+0x1): relocation R_386_PC16 out of range: 65536 is not in [-65536, 65535]; references foo
21
22        .global _start
23_start:
24        jmp foo
25