1; REQUIRES: x86
2; RUN: llvm-as %s -o %t.o
3
4;;
5;; Verify that symbols given by -init and -fini are preserved and
6;; DT_INIT/DT_FINI are created.
7;;
8
9; RUN: ld.lld -o %t.exe -pie %t.o
10; RUN: llvm-nm %t.exe | FileCheck -check-prefix=TEST1 --allow-empty %s
11; RUN: llvm-readelf -d %t.exe | FileCheck -check-prefix=TEST2 %s
12
13; TEST1-NOT: foo
14; TEST1-NOT: bar
15
16; TEST2-NOT: INIT
17; TEST2-NOT: FINI
18
19; RUN: ld.lld -o %t.exe -pie -init=foo -fini=bar %t.o
20; RUN: llvm-nm %t.exe | FileCheck -check-prefix=TEST3 %s
21; RUN: llvm-readelf -d %t.exe | FileCheck -check-prefix=TEST4 %s
22
23; TEST3: bar
24; TEST3: foo
25
26; TEST4: INIT
27; TEST4: FINI
28
29target triple = "x86_64-unknown-linux-gnu"
30target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
31
32define void @foo() {
33  ret void
34}
35
36define void @bar() {
37  ret void
38}
39