File: partition-move-to-main-startstop.s

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (46 lines) | stat: -rw-r--r-- 1,399 bytes parent folder | download | duplicates (5)
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
// REQUIRES: x86
/// Link against a DSO to ensure that sections are not discarded by --gc-sections.
// RUN: llvm-mc -filetype=obj -triple=x86_64 %S/Inputs/shared.s -o %ts.o
// RUN: ld.lld -shared -soname=ts %ts.o -o %ts.so
// RUN: llvm-mc %s -o %t.o -filetype=obj --triple=x86_64-unknown-linux
// RUN: ld.lld %t.o %ts.so -o %t --export-dynamic --gc-sections
// RUN: llvm-readelf -S %t | FileCheck --implicit-check-not=has_startstop %s

// We can't let the has_startstop section be split by partition because it is
// referenced by __start_ and __stop_ symbols, so the split could result in
// some sections being moved out of the __start_/__stop_ range. Make sure that
// that didn't happen by checking that there is only one section.
//
// It's fine for us to split no_startstop because of the lack of
// __start_/__stop_ symbols.

// CHECK: has_startstop
// CHECK: no_startstop

// CHECK: no_startstop

.section .llvm_sympart.f1,"",@llvm_sympart
.asciz "part1"
.quad f1

.section .text._start,"ax",@progbits
.globl _start
_start:
call __start_has_startstop
call __stop_has_startstop

.section .text.f1,"ax",@progbits
.globl f1
f1:

.section has_startstop,"ao",@progbits,.text._start,unique,1
.quad 1

.section has_startstop,"ao",@progbits,.text.f1,unique,2
.quad 2

.section no_startstop,"ao",@progbits,.text._start,unique,1
.quad 3

.section no_startstop,"ao",@progbits,.text.f1,unique,2
.quad 4