1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3# RUN: ld.lld %t -o %tout
4# RUN: llvm-readobj --sections %tout | FileCheck %s
5
6# Check that sections are laid out in the correct order.
7
8.global _start
9.text
10_start:
11
12.section t,"x",@nobits
13.section s,"x"
14.section r,"w",@nobits
15.section q,"w"
16.section p,"wx",@nobits
17.section o,"wx"
18.section n,"",@nobits
19.section m,""
20
21.section l,"awx",@nobits
22.section k,"awx"
23.section j,"aw",@nobits
24.section i,"aw"
25.section g,"awT",@nobits
26.section e,"awT"
27.section d,"ax",@nobits
28.section c,"ax"
29.section a,"a",@nobits
30.section b,"a"
31
32// For non-executable and non-writable sections, PROGBITS appear after others.
33// CHECK: Name: a
34// CHECK: Name: b
35
36// CHECK: Name: c
37// CHECK: Name: d
38
39// Sections that are both writable and executable appear before
40// sections that are only writable.
41// CHECK: Name: k
42// CHECK: Name: l
43
44// TLS sections are only sorted on NOBITS.
45// CHECK: Name: e
46// CHECK: Name: g
47
48// Writable sections appear after TLS and other relro sections.
49// CHECK: Name: i
50
51// CHECK: Name: j
52
53// Non allocated sections are in input order.
54// CHECK: Name: t
55// CHECK: Name: s
56// CHECK: Name: r
57// CHECK: Name: q
58// CHECK: Name: p
59// CHECK: Name: o
60// CHECK: Name: n
61// CHECK: Name: m
62