2 ## Document the behavior when an output section is specified by multiple
3 ## INSERT commands. It is discouraged in the real world.
5 # RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/insert-after.s -o %t.o
6 # RUN: ld.lld -T %s %t.o -o %t
7 # RUN: llvm-readelf -S -l %t | FileCheck %s
9 # CHECK: Name Type Address Off
10 # CHECK-NEXT: NULL 0000000000000000 000000
11 # CHECK-NEXT: .text PROGBITS 0000000000201158 000158
12 # CHECK-NEXT: .foo.text PROGBITS 0000000000201160 000160
13 # CHECK-NEXT: .foo.data PROGBITS 0000000000202168 000168
15 # CHECK-NEXT: PHDR {{.*}} R
16 # CHECK-NEXT: LOAD {{.*}} R
17 # CHECK-NEXT: LOAD {{.*}} R E
18 # CHECK-NEXT: LOAD {{.*}} RW
19 # CHECK-NEXT: GNU_STACK {{.*}} RW
21 ## First, move .foo.data after .foo.text
22 SECTIONS { .foo.data : { *(.foo.data) } } INSERT AFTER .foo.text;
24 ## Next, move .foo.text after .foo.data
25 SECTIONS { .foo.text : { *(.foo.text) } } INSERT AFTER .foo.data;
27 ## Then, move .foo.data after .foo.text again.
28 SECTIONS { .foo.data : { *(.foo.data) } } INSERT AFTER .foo.text;