symbols.s
3.45 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
# Simple symbol assignment. Should raise conflict in case we
# have duplicates in any input section, but currently simply
# replaces the value.
# RUN: echo "SECTIONS {.text : {*(.text.*)} text_end = .;}" > %t.script
# RUN: ld.lld -o %t1 --script %t.script %t
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=SIMPLE %s
# SIMPLE: .text 0000000000000000 text_end
# The symbol is not referenced. Don't provide it.
# RUN: echo "SECTIONS { PROVIDE(newsym = 1);}" > %t.script
# RUN: ld.lld -o %t1 --script %t.script %t
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=DONTPROVIDE %s
# DONTPROVIDE-NOT: newsym
# The symbol is not referenced. Don't provide it.
# RUN: echo "SECTIONS { PROVIDE_HIDDEN(newsym = 1);}" > %t.script
# RUN: ld.lld -o %t1 --script %t.script %t
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=DONTPROVIDE %s
# Provide existing symbol. The value should be 0, even though we
# have value of 1 in PROVIDE()
# RUN: echo "SECTIONS { PROVIDE(somesym = 1);}" > %t.script
# RUN: ld.lld -o %t1 --script %t.script %t
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=PROVIDE2 %s
# PROVIDE2: 0000000000000000 g *ABS* 0000000000000000 somesym
# Provide existing symbol. The value should be 0, even though we
# have value of 1 in PROVIDE_HIDDEN(). Visibility should not change
# RUN: echo "SECTIONS { PROVIDE_HIDDEN(somesym = 1);}" > %t.script
# RUN: ld.lld -o %t1 --script %t.script %t
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN2 %s
# HIDDEN2: 0000000000000000 g *ABS* 0000000000000000 somesym
# Hidden symbol assignment.
# RUN: echo "SECTIONS { HIDDEN(newsym = 1);}" > %t.script
# RUN: ld.lld -o %t1 --script %t.script %t
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN3 %s
# HIDDEN3: 0000000000000001 l *ABS* 0000000000000000 .hidden newsym
# The symbol is not referenced. Don't provide it.
# RUN: echo "PROVIDE(newsym = 1);" > %t.script
# RUN: ld.lld -o %t1 --script %t.script %t
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=DONTPROVIDE %s
# The symbol is not referenced. Don't provide it.
# RUN: echo "PROVIDE_HIDDEN(newsym = 1);" > %t.script
# RUN: ld.lld -o %t1 --script %t.script %t
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=DONTPROVIDE %s
# Provide existing symbol. The value should be 0, even though we
# have value of 1 in PROVIDE()
# RUN: echo "PROVIDE(somesym = 1);" > %t.script
# RUN: ld.lld -o %t1 --script %t.script %t
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=PROVIDE5 %s
# PROVIDE5: 0000000000000000 g *ABS* 0000000000000000 somesym
# Provide existing symbol. The value should be 0, even though we
# have value of 1 in PROVIDE_HIDDEN(). Visibility should not change
# RUN: echo "PROVIDE_HIDDEN(somesym = 1);" > %t.script
# RUN: ld.lld -o %t1 --script %t.script %t
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN5 %s
# HIDDEN5: 0000000000000000 g *ABS* 0000000000000000 somesym
# Simple symbol assignment. All three symbols should have the
# same value.
# RUN: echo "foo = 0x100; SECTIONS { bar = foo; } baz = bar;" > %t.script
# RUN: ld.lld -o %t1 --script %t.script %t
# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=SIMPLE2 %s
# SIMPLE2: 0000000000000100 g *ABS* 0000000000000000 foo
# SIMPLE2: 0000000000000100 g *ABS* 0000000000000000 bar
# SIMPLE2: 0000000000000100 g *ABS* 0000000000000000 baz
.global _start
_start:
nop
.global somesym
somesym = 0