]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ELF/warn-backrefs.s
Vendor import of lld trunk r338150:
[FreeBSD/FreeBSD.git] / test / ELF / warn-backrefs.s
1 # REQUIRES: x86
2
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
4 # RUN: echo ".globl foo; foo:" | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t2.o
5 # RUN: rm -f %t2.a
6 # RUN: llvm-ar rcs %t2.a %t2.o
7
8 # RUN: ld.lld --fatal-warnings -o %t.exe %t1.o %t2.a
9 # RUN: ld.lld --fatal-warnings -o %t.exe %t2.a %t1.o
10 # RUN: ld.lld --fatal-warnings --warn-backrefs -o %t.exe %t1.o %t2.a
11 # RUN: ld.lld --fatal-warnings --warn-backrefs -o %t.exe %t1.o --start-lib %t2.o --end-lib
12
13 # RUN: ld.lld --fatal-warnings --warn-backrefs -o %t.exe --start-group %t2.a %t1.o --end-group
14 # RUN: ld.lld --fatal-warnings --warn-backrefs -o %t.exe "-(" %t2.a %t1.o "-)"
15
16 # RUN: echo "INPUT(\"%t1.o\" \"%t2.a\")" > %t1.script
17 # RUN: ld.lld --fatal-warnings --warn-backrefs -o %t.exe %t1.script
18
19 # RUN: echo "GROUP(\"%t2.a\" \"%t1.o\")" > %t2.script
20 # RUN: ld.lld --fatal-warnings --warn-backrefs -o %t.exe %t2.script
21
22 # RUN: not ld.lld --fatal-warnings --warn-backrefs -o %t.exe %t2.a %t1.o 2>&1 | FileCheck %s
23 # RUN: not ld.lld --fatal-warnings --warn-backrefs -o %t.exe %t2.a "-(" %t1.o "-)" 2>&1 | FileCheck %s
24 # RUN: not ld.lld --fatal-warnings --warn-backrefs -o %t.exe --start-group %t2.a --end-group %t1.o 2>&1 | FileCheck %s
25
26 # RUN: echo "GROUP(\"%t2.a\")" > %t3.script
27 # RUN: not ld.lld --fatal-warnings --warn-backrefs -o %t.exe %t3.script %t1.o 2>&1 | FileCheck %s
28 # RUN: ld.lld --fatal-warnings --warn-backrefs -o %t.exe "-(" %t3.script %t1.o "-)"
29
30 # CHECK: backward reference detected: foo in {{.*}}1.o refers to {{.*}}2.a
31
32 # RUN: not ld.lld --fatal-warnings --start-group --start-group 2>&1 | FileCheck -check-prefix=START %s
33 # START: nested --start-group
34
35 # RUN: not ld.lld --fatal-warnings --end-group 2>&1 | FileCheck -check-prefix=END %s
36 # END: stray --end-group
37
38 # RUN: echo ".globl bar; bar:" | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t3.o
39 # RUN: echo ".globl foo; foo: call bar" | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t4.o
40 # RUN: ld.lld --fatal-warnings --warn-backrefs %t1.o --start-lib %t3.o %t4.o --end-lib -o /dev/null
41
42 # We don't report backward references to weak symbols as they can be overriden later.
43 # RUN: echo ".weak foo; foo:" | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t5.o
44 # RUN: ld.lld --fatal-warnings --warn-backrefs --start-lib %t5.o --end-lib %t1.o %t2.o -o /dev/null
45
46 .globl _start, foo
47 _start:
48   call foo