xref: /llvm-project-15.0.7/lld/test/ELF/entry.s (revision f4debddb)
1# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1
2
3# RUN: ld.lld -e foobar %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN1 %s
4# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=TEXT %s
5
6# WARN1: warning: cannot find entry symbol foobar; defaulting to 0x201000
7# TEXT: Entry: 0x201000
8
9# RUN: ld.lld %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN2 %s
10# WARN2: warning: cannot find entry symbol _start; defaulting to 0x201000
11
12# RUN: ld.lld -shared -e foobar %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN3 %s
13# WARN3: warning: cannot find entry symbol foobar; defaulting to 0x1000
14
15# RUN: ld.lld -shared --fatal-warnings -e entry %t1 -o %t2
16# RUN: ld.lld -shared --fatal-warnings %t1 -o %t2
17
18# RUN: echo .data > %t.s
19# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux -n %t.s -o %t3
20# RUN: ld.lld %t3 -o %t4 2>&1 | FileCheck -check-prefix=WARN4 %s
21# RUN: llvm-readobj -file-headers %t4 | FileCheck -check-prefix=NOENTRY %s
22
23# WARN4: cannot find entry symbol _start; not setting start address
24# NOENTRY: Entry: 0x0
25
26# RUN: ld.lld %t1 -o %t2 -e entry
27# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=SYM %s
28# SYM: Entry: 0x201008
29
30# RUN: ld.lld %t1 --fatal-warnings -shared -o %t2 -e entry
31# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=DSO %s
32# DSO: Entry: 0x1008
33
34# RUN: ld.lld %t1 -o %t2 --entry=4096
35# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=DEC %s
36# DEC: Entry: 0x1000
37
38# RUN: ld.lld %t1 -o %t2 --entry 0xcafe
39# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=HEX %s
40# HEX: Entry: 0xCAFE
41
42# RUN: ld.lld %t1 -o %t2 -e 0777
43# RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=OCT %s
44# OCT: Entry: 0x1FF
45
46.globl entry
47.text
48	.quad 0
49entry:
50	ret
51