1// REQUIRES: x86
2// RUN: llvm-mc %s -o %t.o -filetype=obj --triple=x86_64-unknown-linux
3// RUN: ld.lld %t.o -o %t --export-dynamic --gc-sections
4// RUN: llvm-readelf -S %t | FileCheck --implicit-check-not=has_startstop %s
5
6// We can't let the has_startstop section be split by partition because it is
7// referenced by __start_ and __stop_ symbols, so the split could result in
8// some sections being moved out of the __start_/__stop_ range. Make sure that
9// that didn't happen by checking that there is only one section.
10//
11// It's fine for us to split no_startstop because of the lack of
12// __start_/__stop_ symbols.
13
14// CHECK: has_startstop
15// CHECK: no_startstop
16
17// CHECK: no_startstop
18
19.section .llvm_sympart.f1,"",@llvm_sympart
20.asciz "part1"
21.quad f1
22
23.section .text._start,"ax",@progbits
24.globl _start
25_start:
26call __start_has_startstop
27call __stop_has_startstop
28
29.section .text.f1,"ax",@progbits
30.globl f1
31f1:
32
33.section has_startstop,"ao",@progbits,.text._start,unique,1
34.quad 1
35
36.section has_startstop,"ao",@progbits,.text.f1,unique,2
37.quad 2
38
39.section no_startstop,"ao",@progbits,.text._start,unique,1
40.quad 3
41
42.section no_startstop,"ao",@progbits,.text.f1,unique,2
43.quad 4
44