xref: /llvm-project/lld/test/ELF/linkerscript/sections-va-overflow.test (revision 434341be5be6b3de96b608747176c60b3b561f2c)
123130867SGeorge Rimar# REQUIRES: x86
223130867SGeorge Rimar# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/sections-va-overflow.s -o %t.o
323130867SGeorge Rimar# RUN: not ld.lld -o /dev/null --script %s %t.o 2>&1 | FileCheck %s -check-prefix=ERR
423130867SGeorge Rimar
523130867SGeorge RimarPHDRS {
623130867SGeorge Rimar  ph_headers PT_PHDR PHDRS;
723130867SGeorge Rimar  ph_text PT_LOAD FILEHDR PHDRS FLAGS (0x1 | 0x4);
823130867SGeorge Rimar}
923130867SGeorge Rimar
1023130867SGeorge RimarSECTIONS {
1123130867SGeorge Rimar . = 0xffffffff20000000;
1223130867SGeorge Rimar .text : { *(.text*) } : ph_text
1323130867SGeorge Rimar .test 0x1000 : { BYTE(0) }
1423130867SGeorge Rimar .bss : { *(.bss*) }
1523130867SGeorge Rimar}
1623130867SGeorge Rimar
1723130867SGeorge Rimar## Section .test has VA 0x1000 and placed in the same segment as section .text
1823130867SGeorge Rimar## with VA 0xffffffff20000000. That might be technically correct, but most probably
1923130867SGeorge Rimar## is a result of a broken script file and causes file offset calculation overflow.
2023130867SGeorge Rimar## It seems we do not have to support it, so we don't and we report an error in this case.
21*434341beSGeorge Rimar# ERR: error: unable to place section .text at file offset [0xFFFFFFFF20000000, 0xFFFFFFFF20000000]; check your linker script for overflows
2223130867SGeorge Rimar# ERR-NOT: unable to place section .bss
23