[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / lld / test / ELF / ttext-tdata-tbss.s
blobc8254d69692935cb81980231ad2b9f1a8badc564
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
4 ## Show what regular output gives to us.
5 # RUN: ld.lld %t.o -o %t1
6 # RUN: llvm-readelf -S -l %t1 | FileCheck %s
7 # CHECK: .rodata PROGBITS 0000000000200158 000158 000008
8 # CHECK-NEXT: .text PROGBITS 0000000000201160 000160 000001
9 # CHECK-NEXT: .aw PROGBITS 0000000000202161 000161 000008
10 # CHECK-NEXT: .data PROGBITS 0000000000202169 000169 000008
11 # CHECK-NEXT: .bss NOBITS 0000000000202171 000171 000008
12 # CHECK: Type
13 # CHECK-NEXT: PHDR
14 # CHECK-NEXT: LOAD 0x000000 0x0000000000200000
16 ## If -Ttext is smaller than the image base (which defaults to 0x200000 for -no-pie),
17 ## the headers will still be allocated, but mapped at a higher address,
18 ## which may look strange.
19 # RUN: ld.lld -Ttext 0x0 -Tdata 0x4000 -Tbss 0x8000 %t.o -o %t2
20 # RUN: llvm-readelf -S -l %t2 | FileCheck %s --check-prefix=USER1
21 # USER1: .text PROGBITS 0000000000000000 001000 000001
22 # USER1-NEXT: .data PROGBITS 0000000000004000 002000 000008
23 # USER1-NEXT: .bss NOBITS 0000000000008000 002008 000008
24 # USER1-NEXT: .rodata PROGBITS 0000000000009008 002008 000008
25 # USER1-NEXT: .aw PROGBITS 000000000000a010 002010 000008
26 # USER1: Type
27 # USER1-NEXT: PHDR 0x000040 0x0000000000200040
28 # USER1-NEXT: LOAD 0x000000 0x0000000000200000
29 # USER1-NEXT: LOAD 0x001000 0x0000000000000000
31 ## Specify --image-base to make program headers look normal.
32 # RUN: ld.lld --image-base=0 -Ttext 0x1000 -Tdata 0x4000 -Tbss 0x8000 %t.o -o %t3
33 # RUN: llvm-readelf -S -l %t3 | FileCheck %s --check-prefix=USER2
34 # USER2: .text PROGBITS 0000000000001000 001000 000001
35 # USER2-NEXT: .data PROGBITS 0000000000004000 002000 000008
36 # USER2-NEXT: .bss NOBITS 0000000000008000 002008 000008
37 # USER2-NEXT: .rodata PROGBITS 0000000000009008 002008 000008
38 # USER2-NEXT: .aw PROGBITS 000000000000a010 002010 000008
39 # USER2: Type
40 # USER2-NEXT: PHDR 0x000040 0x0000000000000040
41 # USER2-NEXT: LOAD 0x000000 0x0000000000000000
42 # USER2-NEXT: LOAD 0x001000 0x0000000000001000
44 ## With .text well above 200000 we don't need to change the image base
45 # RUN: ld.lld -Ttext 0x201000 -z separate-loadable-segments %t.o -o %t4
46 # RUN: llvm-readelf -S -l %t4 | FileCheck %s --check-prefix=USER3
47 # USER3: .text PROGBITS 0000000000201000 001000 000001
48 # USER3-NEXT: .rodata PROGBITS 0000000000202000 002000 000008
49 # USER3-NEXT: .aw PROGBITS 0000000000203000 003000 000008
50 # USER3-NEXT: .data PROGBITS 0000000000203008 003008 000008
51 # USER3-NEXT: .bss NOBITS 0000000000203010 003010 000008
52 # USER3: Type
53 # USER3-NEXT: PHDR 0x000040 0x0000000000200040
54 # USER3-NEXT: LOAD 0x000000 0x0000000000200000
55 # USER3-NEXT: LOAD 0x001000 0x0000000000201000
57 .text
58 .globl _start
59 _start:
60 nop
62 .section .rodata,"a"
63 .quad 0
65 .section .aw,"aw"
66 .quad 0
68 .section .data,"aw"
69 .quad 0
71 .section .bss,"",@nobits
72 .quad 0