xref: /llvm-project/lld/test/ELF/linkerscript/merge-header-load.s (revision 3c9d86f9515e2cdc57dd76095ab9099aa399f652)
1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3# RUN: echo "SECTIONS {                  \
4# RUN:  . = 0xffffffff80000200;          \
5# RUN:  .text : AT (0x4200) { *(.text) } \
6# RUN: }" > %t.script
7# RUN: ld.lld %t.o --script %t.script -o %t
8# RUN: llvm-readelf -l %t | FileCheck %s
9
10# Test that we put the header in the first PT_LOAD. We used to create a PT_LOAD
11# just for it and it would have a different virtual to physical address delta.
12
13# CHECK: Program Headers:
14# CHECK:      Type  Offset   VirtAddr           PhysAddr
15# CHECK-NEXT: PHDR  0x000040 0xffffffff80000040 0xffffffff80000040
16# CHECK-NEXT: LOAD  0x000000 0xffffffff80000000 0xffffffff80000000
17# CHECK-NEXT: LOAD  0x000200 0xffffffff80000200 0x0000000000004200
18# CHECK-NOT:  LOAD
19
20.global _start
21_start:
22nop
23