File: orphan.s

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,388 kB
  • sloc: cpp: 7,438,767; ansic: 1,393,871; asm: 1,012,926; python: 241,728; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (136 lines) | stat: -rw-r--r-- 5,309 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# REQUIRES: x86
# RUN: rm -rf %t && split-file %s %t && cd %t
# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o

## .jcr is a relro section and should be placed before other RW sections.
## .bss is SHT_NOBITS section and should be last RW section, so some space
## in ELF file could be saved.
# RUN: ld.lld a.o -T text-rw.lds -o text-rw
# RUN: llvm-readelf -S text-rw | FileCheck %s --check-prefix=TEXT-RW
# TEXT-RW:      .interp   PROGBITS 00000000000002{{..}} 0
# TEXT-RW-NEXT: .note.my  NOTE     00000000000002{{..}} 0
# TEXT-RW-NEXT: .text     PROGBITS 00000000000002{{..}} 0
# TEXT-RW-NEXT: .mytext   PROGBITS 00000000000002{{..}} 0
# TEXT-RW-NEXT: .jcr      PROGBITS 00000000000002{{..}} 0
# TEXT-RW-NEXT: .rw1      PROGBITS 0000000000001{{...}} 0
# TEXT-RW-NEXT: .rw2      PROGBITS 0000000000001{{...}} 0
# TEXT-RW-NEXT: .rw3      PROGBITS 0000000000001{{...}} 0
# TEXT-RW-NEXT: .bss      NOBITS   0000000000001{{...}} 0

# RUN: ld.lld a.o -T only-text.lds -o only-text
# RUN: llvm-readelf -S only-text | FileCheck %s --check-prefix=ONLY-TEXT
# ONLY-TEXT:      .interp   PROGBITS 00000000000002{{..}} 0
# ONLY-TEXT-NEXT: .note.my  NOTE     00000000000002{{..}} 0
# ONLY-TEXT-NEXT: .text     PROGBITS 00000000000002{{..}} 0
# ONLY-TEXT-NEXT: .mytext   PROGBITS 00000000000002{{..}} 0
# ONLY-TEXT-NEXT: .jcr      PROGBITS 00000000000002{{..}} 0
# ONLY-TEXT-NEXT: .rw1      PROGBITS 00000000000002{{..}} 0
# ONLY-TEXT-NEXT: .rw2      PROGBITS 00000000000002{{..}} 0
# ONLY-TEXT-NEXT: .rw3      PROGBITS 00000000000002{{..}} 0
# ONLY-TEXT-NEXT: .bss      NOBITS   00000000000002{{..}} 0

# RUN: ld.lld a.o -T text-align.lds -o text-align
# RUN: llvm-readelf -S text-align | FileCheck %s --check-prefix=TEXT-ALIGN
# TEXT-ALIGN:      .interp   PROGBITS 00000000000002{{..}} 0
# TEXT-ALIGN-NEXT: .note.my  NOTE     00000000000002{{..}} 0
# TEXT-ALIGN-NEXT: .text     PROGBITS 00000000000002{{..}} 0
# TEXT-ALIGN-NEXT: .mytext   PROGBITS 0000000000001000     0
# TEXT-ALIGN-NEXT: .jcr      PROGBITS 0000000000001{{...}} 0
# TEXT-ALIGN-NEXT: .rw1      PROGBITS 0000000000001{{...}} 0
# TEXT-ALIGN-NEXT: .rw2      PROGBITS 0000000000001{{...}} 0
# TEXT-ALIGN-NEXT: .rw3      PROGBITS 0000000000001{{...}} 0
# TEXT-ALIGN-NEXT: .bss      NOBITS   0000000000001{{...}} 0

# RUN: ld.lld a.o -T only-rw.lds -o only-rw
# RUN: llvm-readelf -S only-rw | FileCheck %s --check-prefix=ONLY-RW
# ONLY-RW:         .interp   PROGBITS 00000000000002{{..}} 0
# ONLY-RW-NEXT:    .note.my  NOTE     00000000000002{{..}} 0
# ONLY-RW-NEXT:    .text     PROGBITS 00000000000002{{..}} 0
# ONLY-RW-NEXT:    .mytext   PROGBITS 00000000000002{{..}} 0
# ONLY-RW-NEXT:    .jcr      PROGBITS 00000000000002{{..}} 0
# ONLY-RW-NEXT:    .rw1      PROGBITS 00000000000002{{..}} 0
# ONLY-RW-NEXT:    .rw2      PROGBITS 0000000000001{{...}} 0
# ONLY-RW-NEXT:    .rw3      PROGBITS 0000000000001{{...}} 0
# ONLY-RW-NEXT:    .bss      NOBITS   0000000000001{{...}} 0

# RUN: ld.lld a.o -T rw-text.lds -o rw-text
# RUN: llvm-readelf -S rw-text | FileCheck %s --check-prefix=RW-TEXT
# RW-TEXT:      .jcr      PROGBITS 00000000000002{{..}} 0
# RW-TEXT-NEXT: .rw1      PROGBITS 00000000000002{{..}} 0
# RW-TEXT-NEXT: .rw2      PROGBITS 00000000000002{{..}} 0
# RW-TEXT-NEXT: .rw3      PROGBITS 00000000000002{{..}} 0
# RW-TEXT-NEXT: .bss      NOBITS   00000000000002{{..}} 0
# RW-TEXT-NEXT: .interp   PROGBITS 00000000000002{{..}} 0
# RW-TEXT-NEXT: .note.my  NOTE     00000000000002{{..}} 0
# RW-TEXT-NEXT: .text     PROGBITS 0000000000001{{...}} 0
# RW-TEXT-NEXT: .mytext   PROGBITS 0000000000001{{...}} 0

# RUN: ld.lld a.o -T rw-text-rw.lds -o rw-text-rw
# RUN: llvm-readelf -S rw-text-rw | FileCheck %s --check-prefix=RW-TEXT-RW
# RW-TEXT-RW:      .jcr      PROGBITS 00000000000002{{..}} 0
# RW-TEXT-RW-NEXT: .rw1      PROGBITS 00000000000002{{..}} 0
# RW-TEXT-RW-NEXT: .interp   PROGBITS 00000000000002{{..}} 0
# RW-TEXT-RW-NEXT: .note.my  NOTE     00000000000002{{..}} 0
# RW-TEXT-RW-NEXT: .text     PROGBITS 0000000000001{{...}} 0
# RW-TEXT-RW-NEXT: .mytext   PROGBITS 0000000000001{{...}} 0
# RW-TEXT-RW-NEXT: .rw2      PROGBITS 0000000000002{{...}} 0
# RW-TEXT-RW-NEXT: .rw3      PROGBITS 0000000000002{{...}} 0
# RW-TEXT-RW-NEXT: .bss      NOBITS   0000000000002{{...}} 0

#--- a.s
.section .rw1, "aw"; .byte 0
.section .rw2, "aw"; .byte 0
.section .rw3, "aw"; .byte 0
.section .jcr, "aw"; .byte 0
.section .bss, "aw",@nobits; .byte 0
.section .note.my, "a", @note; .byte 0
.section .interp, "a", @progbits; .byte 0
.text; nop
.section .mytext,"ax"; nop

#--- text-rw.lds
SECTIONS {
  . = SIZEOF_HEADERS;
  .text : { *(.text) }
  . = ALIGN(CONSTANT(MAXPAGESIZE));
  .rw1 : { *(.rw1) }
  .rw2 : { *(.rw2) }
}

#--- only-text.lds
SECTIONS {
  . = SIZEOF_HEADERS;
  .text : { *(.text) }
}

#--- text-align.lds
SECTIONS {
  . = SIZEOF_HEADERS;
  .text : { *(.text) }
  . = ALIGN(CONSTANT(MAXPAGESIZE));
}

#--- only-rw.lds
SECTIONS {
  . = SIZEOF_HEADERS;
  .rw1 : { *(.rw1) }
  . = ALIGN(CONSTANT(MAXPAGESIZE));
}

#--- rw-text.lds
SECTIONS {
  . = SIZEOF_HEADERS;
  .rw1 : { *(.rw1) }
  . = ALIGN(CONSTANT(MAXPAGESIZE));
  .text : { *(.text) }
}

#--- rw-text-rw.lds
SECTIONS {
  . = SIZEOF_HEADERS;
  .rw1 : { *(.rw1) }
  . = ALIGN(CONSTANT(MAXPAGESIZE));
  .text : { *(.text) }
  . = ALIGN(CONSTANT(MAXPAGESIZE));
  .rw2 : { *(.rw2) }
}