[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / gc-sections-linkorder-err.s
blob0f96e4157dfc2d1f20e73fca8a540438e9faf724
1 # REQUIRES: x86
3 ## Error if the linked-to section of an input section is discarded.
5 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
6 # RUN: not ld.lld --gc-sections --print-gc-sections %t.o -o /dev/null 2>&1 | FileCheck %s
8 # CHECK: removing unused section {{.*}}.o:(.foo0)
9 # CHECK-NEXT: error: {{.*}}.o:(.bar): sh_link points to discarded section {{.*}}.o:(.foo0)
10 # CHECK-NEXT: error: {{.*}}.o:(.baz): sh_link points to discarded section {{.*}}.o:(.foo0)
12 .globl _start
13 _start:
14 call .foo1
15 call bar0
16 call bar1
17 call baz0
18 call baz1
20 .section .foo0,"a"
21 .section .foo1,"a"
23 ## The linked-to section of the first input section is discarded.
24 .section .bar,"ao",@progbits,.foo0,unique,0
25 bar0:
26 .byte 0
27 .section .bar,"ao",@progbits,.foo1,unique,1
28 bar1:
29 .byte 1
31 ## Another case: the linked-to section of the second input section is discarded.
32 .section .baz,"ao",@progbits,.foo1,unique,0
33 baz0:
34 .byte 0
35 .section .baz,"ao",@progbits,.foo0,unique,1
36 baz1:
37 .byte 1