1// REQUIRES: x86
2// RUN: llvm-mc --triple=x86_64 -filetype=obj %s -o %t.o
3// RUN: echo "SECTIONS { \
4// RUN:         . = 0x80000000; \
5// RUN:         .linkorder : { *(.linkorder.*) } \
6// RUN:         .text : { *(.text) } \
7// RUN:         .text.1 0x80000200 : AT(0x1000) { *(.text.1) } \
8// RUN:         .text.2 0x80000100 : AT(0x2000) { *(.text.2) } \
9// RUN: } " > %t.script
10// RUN: ld.lld --script %t.script %t.o -o %t
11// RUN: llvm-readobj -x .linkorder  %t | FileCheck %s
12
13/// When a linker script does not have monotonically increasing addresses
14/// the SHF_LINK_ORDER sections should still be in monotonically increasing
15/// order.
16
17// CHECK: Hex dump of section '.linkorder':
18// CHECK-NEXT: 0x80000000 0201
19
20.section .text.1, "ax", %progbits
21.global _start
22_start:
23nop
24
25.section .text.2, "ax", %progbits
26.byte 0
27
28.section .linkorder.1, "ao", %progbits, .text.1
29.byte 1
30
31.section .linkorder.2, "ao", %progbits, .text.2
32.byte 2
33