1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/sections-va-overflow.s -o %t.o
3# RUN: not ld.lld -o /dev/null --script %s %t.o 2>&1 | FileCheck %s -check-prefix=ERR
4
5PHDRS {
6  ph_headers PT_PHDR PHDRS;
7  ph_text PT_LOAD FILEHDR PHDRS FLAGS (0x1 | 0x4);
8}
9
10SECTIONS {
11 . = 0xffffffff20000000;
12 .text : { *(.text*) } : ph_text
13 .test 0x1000 : { BYTE(0) }
14 .bss : { *(.bss*) }
15}
16
17## Section .test has VA 0x1000 and placed in the same segment as section .text
18## with VA 0xffffffff20000000. That might be technically correct, but most probably
19## is a result of a broken script file and causes file offset calculation overflow.
20## It seems we do not have to support it, so we don't and we report an error in this case.
21# ERR: error: unable to place section .text at file offset [0xFFFFFFFF20000000, 0xFFFFFFFF20000000]; check your linker script for overflows
22# ERR-NOT: unable to place section .bss
23