xref: /llvm-project/lld/test/ELF/map-file-copy.s (revision 5a58e98c2018f8cfea71e34e9717da40201a966b)
1# REQUIRES: x86
2
3# RUN: split-file %s %t
4# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/1.s -o %t/1.o
5# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/2.s -o %t/2.o
6# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/3.s -o %t/3.o
7# RUN: ld.lld -shared -soname=3 --version-script=%t/3.ver %t/3.o -o %t/3.so
8# RUN: ld.lld -Map=%t/1.map %t/1.o %t/2.o %t/3.so -o %t/1
9# RUN: FileCheck %s --input-file=%t/1.map
10
11## Both TUs reference func/copy which need a canonical PLT entry/copy relocation.
12## Test we print func/copy just once.
13# CHECK:      {{ }}.plt
14# CHECK-NEXT:         <internal>:(.plt)
15# CHECK-NEXT:                 func@v1{{$}}
16# CHECK-NEXT: .dynamic
17
18# CHECK:      .bss.rel.ro
19# CHECK-NEXT:         <internal>:(.bss.rel.ro)
20## Ideally this is displayed as copy@v2.
21# CHECK-NEXT:                 copy{{$}}
22# CHECK-NEXT: .relro_padding
23
24#--- 1.s
25.global _start
26_start:
27.symver func, func@@@v1
28  mov $copy, %eax
29  mov $func - ., %eax
30
31#--- 2.s
32.symver func, func@@@v1
33  mov $copy, %eax
34  mov $func - ., %eax
35
36#--- 3.s
37.globl func
38.symver func, func@v1, remove
39.type func, @function
40func:
41  ret
42
43.section .rodata,"a"
44.globl copy
45.type copy, @object
46copy:
47.byte 1
48.size copy, 1
49
50#--- 3.ver
51v1 { func; };
52v2 { copy; };
53