2017-07-19 02:40:50 +08:00
|
|
|
// REQUIRES: x86
|
2017-06-09 08:48:55 +08:00
|
|
|
// RUN: llvm-mc %s -o %t.o -triple i386-pc-linux-code16 -filetype=obj
|
|
|
|
|
2017-06-10 09:56:58 +08:00
|
|
|
// RUN: echo ".global foo; foo = 0x10202" > %t1.s
|
2017-06-09 08:48:55 +08:00
|
|
|
// RUN: llvm-mc %t1.s -o %t1.o -triple i386-pc-linux -filetype=obj
|
2017-06-10 09:56:58 +08:00
|
|
|
// RUN: echo ".global foo; foo = 0x10203" > %t2.s
|
2017-06-09 08:48:55 +08:00
|
|
|
// RUN: llvm-mc %t2.s -o %t2.o -triple i386-pc-linux -filetype=obj
|
|
|
|
|
|
|
|
// RUN: ld.lld -Ttext 0x200 %t.o %t1.o -o %t1
|
2020-03-16 08:47:44 +08:00
|
|
|
// RUN: llvm-objdump -d --no-show-raw-insn --triple=i386-pc-linux-code16 %t1 | FileCheck %s
|
2017-06-09 08:48:55 +08:00
|
|
|
|
|
|
|
// CHECK: Disassembly of section .text:
|
2019-05-01 18:40:48 +08:00
|
|
|
// CHECK-EMPTY:
|
2020-03-06 06:18:38 +08:00
|
|
|
// CHECK-NEXT: <_start>:
|
2020-03-23 06:03:10 +08:00
|
|
|
// CHECK-NEXT: 200: jmp 0x202
|
2017-06-10 09:56:58 +08:00
|
|
|
// 0x10202 - 0x203 == 0xffff
|
2017-06-09 08:48:55 +08:00
|
|
|
|
2018-07-03 01:48:23 +08:00
|
|
|
// RUN: not ld.lld -Ttext 0x200 %t.o %t2.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
|
2017-06-09 08:48:55 +08:00
|
|
|
|
2020-01-28 09:35:06 +08:00
|
|
|
// ERR: {{.*}}:(.text+0x1): relocation R_386_PC16 out of range: 65536 is not in [-65536, 65535]; references foo
|
2017-06-09 08:48:55 +08:00
|
|
|
|
|
|
|
.global _start
|
|
|
|
_start:
|
|
|
|
jmp foo
|