xref: /llvm-project/lld/test/ELF/linkerscript/insert-multi.test (revision 03051f7ac8a3e2eda44b8280290c90863a064f0e)
1# REQUIRES: x86
2## Sections in an INSERT command are in a unit. Their order is preserved.
3
4# RUN: split-file %s %t
5# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o
6# RUN: ld.lld -T %t/a.lds %t/a.o -o %t1
7# RUN: llvm-readelf -S -l %t1 | FileCheck %s
8
9# CHECK:      Name
10# CHECK-NEXT:        NULL
11# CHECK-NEXT: text.3
12# CHECK-NEXT: text.4
13# CHECK-NEXT: text.5
14# CHECK-NEXT: .text
15# CHECK-NEXT: .data
16# CHECK-NEXT: text.6
17# CHECK-NEXT: text.7
18# CHECK-NEXT: text.8
19# CHECK-NEXT: text.0
20# CHECK-NEXT: text.1
21# CHECK-NEXT: text.2
22
23#--- a.lds
24SECTIONS {
25  text.0 : {}
26  text.1 : {}
27  text.2 : {}
28} INSERT AFTER .data;
29
30SECTIONS {
31  text.3 : {}
32  text.4 : {}
33  text.5 : {}
34} INSERT BEFORE .text;
35
36SECTIONS {
37  text.6 : {}
38  text.7 : {}
39  text.8 : {}
40} INSERT AFTER .data;
41
42#--- a.s
43.text; nop
44.section text.0,"ax"; nop
45.section text.1,"ax"; nop
46.section text.2,"ax"; nop
47.section text.3,"ax"; nop
48.section text.4,"ax"; nop
49.section text.5,"ax"; nop
50.section text.6,"ax"; nop
51.section text.7,"ax"; nop
52.section text.8,"ax"; nop
53.data; .byte 0
54