[ELF] Refine isExported/isPreemptible condition
[llvm-project.git] / lld / test / ELF / partitions.s
blob0fc25b4da86171247ddfa02dcbda2654302507cf
1 // REQUIRES: aarch64, x86
2 /// Link against a DSO to ensure that sections are not discarded by --gc-sections.
3 // RUN: llvm-mc %S/Inputs/shared.s -o %ts.o -filetype=obj --triple=x86_64
4 // RUN: ld.lld -shared -soname=ts %ts.o -o %ts.so
5 // RUN: llvm-mc %s -o %t.o -filetype=obj --triple=x86_64-unknown-linux
6 // RUN: ld.lld %t.o %ts.so -o %t --export-dynamic --gc-sections -z max-page-size=65536
7 // RUN: llvm-readelf -S -s %t | FileCheck %s
9 // RUN: llvm-mc %S/Inputs/shared.s -o %ts.o -filetype=obj --triple=aarch64
10 // RUN: ld.lld -shared -soname=ts %ts.o -o %ts.so
11 // RUN: llvm-mc %s -o %t.o -filetype=obj --triple=aarch64 --crel
12 // RUN: ld.lld %t.o %ts.so -o %t --export-dynamic --gc-sections
13 // RUN: llvm-readelf -S -s %t | FileCheck %s
15 // This is basically lld/docs/partitions.dot in object file form.
16 // Test that the sections are correctly allocated to partitions.
17 // part1 and part2 should be aligned to a maximum page size boundary.
19 // CHECK: [[MAIN:[0-9]+]]] .text
20 // CHECK: part1 LLVM_PART_EHDR {{[0-9a-f]+}}0000 {{[0-9a-f]+}}0000
21 // CHECK: [[P1:[0-9]+]]] .text
22 // CHECK: part2 LLVM_PART_EHDR {{[0-9a-f]+}}0000 {{[0-9a-f]+}}0000
23 // CHECK: [[P2:[0-9]+]]] .text
25 // CHECK: Symbol table '.symtab'
26 // CHECK: [[MAIN]] f3
27 // CHECK: [[P1]] f4
28 // CHECK: [[MAIN]] f5
29 // CHECK: [[P2]] f6
30 // CHECK: [[P1]] f1
31 // CHECK: [[P2]] f2
32 // CHECK: [[MAIN]] _start
34 .section .llvm_sympart.f1,"",@llvm_sympart
35 .asciz "part1"
36 .quad f1
38 .section .llvm_sympart.f2,"",@llvm_sympart
39 .asciz "part2"
40 .quad f2
42 .section .text._start,"ax",@progbits
43 .globl _start
44 _start:
45 .quad f3
47 .section .text.f1,"ax",@progbits
48 .globl f1
49 f1:
50 .quad f3
51 .quad f4
52 .quad f5
54 .section .text.f2,"ax",@progbits
55 .globl f2
56 f2:
57 .quad f3
58 .quad f5
59 .quad f6
61 .section .text.f3,"ax",@progbits
62 f3:
63 ret
65 .section .text.f4,"ax",@progbits
66 f4:
67 ret
69 .section .text.f5,"ax",@progbits
70 f5:
71 ret
73 .section .text.f6,"ax",@progbits
74 f6:
75 ret