[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / weak-undef.s
blob3a9d5f462c21b6ae937eeeb8872cf6ed455d0551
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3 # RUN: ld.lld %t.o -o %t --export-dynamic
4 # RUN: llvm-readelf -r --dyn-syms --hex-dump=.data %t | \
5 # RUN: FileCheck %s --check-prefixes=NORELOC,COMMON
7 # NORELOC: There are no relocations in this file.
9 # RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/dummy-shared.s -o %t1.o
10 # RUN: ld.lld %t1.o -shared -o %t1.so
11 # RUN: ld.lld %t.o -o %t %t1.so -pie
12 # RUN: llvm-readelf -r --dyn-syms --hex-dump=.data %t | \
13 # RUN: FileCheck %s --check-prefixes=RELOC,COMMON
15 # RELOC: Relocation section '.rela.dyn' at offset {{.*}} contains 1 entries:
16 # RELOC-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
17 # RELOC-NEXT: {{.*}} 0000000100000001 R_X86_64_64 0000000000000000 foo + 0
19 # COMMON: Symbol table '.dynsym' contains 2 entries:
20 # COMMON-NEXT: Num: Value Size Type Bind Vis Ndx Name
21 # COMMON-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
22 # COMMON-NEXT: 1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND foo
23 # COMMON: Hex dump of section '.data':
24 # COMMON-NEXT: {{.*}} 00000000 00000000
25 # COMMON-EMPTY:
27 .weak foo
29 .data
30 .dc.a foo