|
1 | 1 | # REQUIRES: x86
|
2 |
| -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t |
| 2 | +# RUN: rm -rf %t && split-file %s %t && cd %t |
| 3 | +# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o |
3 | 4 |
|
4 | 5 | # Provide new symbol. The value should be 1, like set in PROVIDE()
|
5 |
| -# RUN: echo "SECTIONS { PROVIDE(newsym = 1);}" > %t.script |
6 |
| -# RUN: ld.lld -o %t1 --script %t.script %t |
7 |
| -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=PROVIDE1 %s |
| 6 | +# RUN: echo "SECTIONS { PROVIDE(newsym = 1);}" > a1.t |
| 7 | +# RUN: ld.lld -o a1 -T a1.t a.o |
| 8 | +# RUN: llvm-objdump -t a1 | FileCheck --check-prefix=PROVIDE1 %s |
8 | 9 | # PROVIDE1: 0000000000000001 g *ABS* 0000000000000000 newsym
|
9 | 10 |
|
10 | 11 | # Provide new symbol (hidden). The value should be 1
|
11 |
| -# RUN: echo "SECTIONS { PROVIDE_HIDDEN(newsym = 1);}" > %t.script |
12 |
| -# RUN: ld.lld -o %t1 --script %t.script %t |
13 |
| -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN1 %s |
| 12 | +# RUN: echo "SECTIONS { PROVIDE_HIDDEN(newsym = 1);}" > a2.t |
| 13 | +# RUN: ld.lld -o a2 -T a2.t a.o |
| 14 | +# RUN: llvm-objdump -t a2 | FileCheck --check-prefix=HIDDEN1 %s |
14 | 15 | # HIDDEN1: 0000000000000001 l *ABS* 0000000000000000 .hidden newsym
|
15 | 16 |
|
16 |
| -# RUN: echo 'SECTIONS { PROVIDE_HIDDEN("newsym" = 1);}' > %t.script |
17 |
| -# RUN: ld.lld -o %t1 --script %t.script %t |
18 |
| -# RUN: llvm-objdump -t %t1 | FileCheck --check-prefix=HIDDEN1 %s |
| 17 | +# RUN: echo 'SECTIONS { PROVIDE_HIDDEN("newsym" = 1);}' > a2.t |
| 18 | +# RUN: ld.lld -o a2 -T a2.t a.o |
| 19 | +# RUN: llvm-objdump -t a2 | FileCheck --check-prefix=HIDDEN1 %s |
19 | 20 |
|
| 21 | +# RUN: ld.lld -o chain -T chain.t a.o |
| 22 | +# RUN: llvm-nm chain | FileCheck %s |
| 23 | + |
| 24 | +# CHECK: 0000000000001000 a f1 |
| 25 | +# CHECK-NEXT: 0000000000001000 A f2 |
| 26 | +# CHECK-NEXT: 0000000000001000 a g1 |
| 27 | +# CHECK-NEXT: 0000000000001000 A g2 |
| 28 | +# CHECK-NEXT: 0000000000001000 A newsym |
| 29 | + |
| 30 | +# RUN: not ld.lld -T chain2.t a.o 2>&1 | FileCheck %s --check-prefix=ERR --implicit-check-not=error: |
| 31 | +# ERR-COUNT-3: error: chain2.t:1: symbol not found: undef |
| 32 | + |
| 33 | +#--- a.s |
20 | 34 | .global _start
|
21 | 35 | _start:
|
22 | 36 | nop
|
23 | 37 |
|
24 | 38 | .globl patatino
|
25 | 39 | patatino:
|
26 | 40 | movl newsym, %eax
|
| 41 | + |
| 42 | +#--- chain.t |
| 43 | +PROVIDE(f2 = 0x1000); |
| 44 | +PROVIDE_HIDDEN(f1 = f2); |
| 45 | +PROVIDE(newsym = f1); |
| 46 | + |
| 47 | +PROVIDE(g2 = 0x1000); |
| 48 | +PROVIDE_HIDDEN(g1 = g2); |
| 49 | +PROVIDE(unused = g1); |
| 50 | + |
| 51 | +#--- chain2.t |
| 52 | +PROVIDE(f2 = undef); |
| 53 | +PROVIDE_HIDDEN(f1 = f2); |
| 54 | +PROVIDE(newsym = f1); |
0 commit comments