1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3
4# RUN: ld.lld %t.o -o %t.out
5# RUN: llvm-readelf -x .text %t.out | FileCheck %s
6# CHECK: Hex dump of section '.text':
7# CHECK-NEXT: 01020304
8
9## --shuffle-sections= shuffles input sections.
10# RUN: ld.lld --shuffle-sections=1 %t.o -o %t1.out
11# RUN: llvm-readelf -x .text %t1.out | FileCheck %s --check-prefix=SHUFFLE1
12# SHUFFLE1: Hex dump of section '.text':
13# SHUFFLE1-NEXT: 0204cccc 0103
14
15## Test that --shuffle-sections= can be used with --symbol-ordering-file
16# RUN: echo "foo" > %t_order.txt
17# RUN: echo "_start " >> %t_order.txt
18
19# RUN: ld.lld --symbol-ordering-file %t_order.txt --shuffle-sections=2 %t.o -o %t2.out
20# RUN: llvm-readelf -x .text %t2.out | FileCheck %s --check-prefix=SHUFFLE2
21# SHUFFLE2: Hex dump of section '.text':
22# SHUFFLE2-NEXT: 02cccccc 010304
23
24# RUN: ld.lld --symbol-ordering-file %t_order.txt --shuffle-sections=3 %t.o -o %t3.out
25# RUN: llvm-readelf -x .text %t3.out | FileCheck %s --check-prefix=SHUFFLE3
26# SHUFFLE3: Hex dump of section '.text':
27# SHUFFLE3-NEXT: 02cccccc 010403
28
29## .text has an alignment of 4.
30.global _start
31_start:
32  .byte 1
33
34.section .text.foo,"ax"
35.global foo
36foo:
37  .byte 2
38
39.section .text.bar,"ax"
40.global bar
41bar:
42  .byte 3
43
44.section .text.zed,"ax"
45.global zed
46zed:
47  .byte 4
48