[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / map-file-copy.s
blob58c0ce98104809307465acf5946ef8271bd3f4f9
1 # REQUIRES: x86
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
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
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: .got.plt
24 #--- 1.s
25 .global _start
26 _start:
27 .symver func, func@@@v1
28 mov $copy, %eax
29 mov $func - ., %eax
31 #--- 2.s
32 .symver func, func@@@v1
33 mov $copy, %eax
34 mov $func - ., %eax
36 #--- 3.s
37 .globl func
38 .symver func, func@v1, remove
39 .type func, @function
40 func:
41 ret
43 .section .rodata,"a"
44 .globl copy
45 .type copy, @object
46 copy:
47 .byte 1
48 .size copy, 1
50 #--- 3.ver
51 v1 { func; };
52 v2 { copy; };