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