[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / gc-sections-startstop-hint.s
blob33d088fa3af778a2e6c8aca9806a1a8352fff542
1 # REQUIRES: x86
2 ## Some projects may not work with GNU ld<2015-10 (ld.lld 13.0.0) --gc-sections behavior.
3 ## Give a hint.
5 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
6 # RUN: ld.lld %t.o -o /dev/null
7 # RUN: ld.lld %t.o --gc-sections -z nostart-stop-gc -o /dev/null
8 # RUN: not ld.lld %t.o --gc-sections -o /dev/null 2>&1 | FileCheck %s
10 # CHECK: error: undefined symbol: __start_meta
11 # CHECK-NEXT: >>> referenced by {{.*}}
12 # CHECK-NEXT: >>> the encapsulation symbol needs to be retained under --gc-sections properly; consider -z nostart-stop-gc (see https://lld.llvm.org/ELF/start-stop-gc)
14 .section .text,"ax",@progbits
15 .global _start
16 _start:
17 .quad __start_meta - .
18 .quad __stop_meta - .
20 .section meta,"aw",@progbits
21 .quad 0