1# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
2# RUN: ld.lld %t -o %tout
3# RUN: llvm-readobj -sections %tout | FileCheck %s
4# REQUIRES: x86
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 b,"a",@nobits
30.section a,"a"
31
32// CHECK: Name: a
33// CHECK: Name: b
34// CHECK: Name: c
35// CHECK: Name: d
36
37// Sections that are both writable and executable appear before
38// sections that are only writable.
39// CHECK: Name: k
40// CHECK: Name: l
41
42// Writable sections appear before TLS and other relro sections.
43// CHECK: Name: i
44
45// TLS sections are only sorted on NOBITS.
46// CHECK: Name: e
47// CHECK: Name: g
48
49// CHECK: Name: j
50
51// Non allocated sections are in input order.
52// CHECK: Name: t
53// CHECK: Name: s
54// CHECK: Name: r
55// CHECK: Name: q
56// CHECK: Name: p
57// CHECK: Name: o
58// CHECK: Name: n
59// CHECK: Name: m
60