1# REQUIRES: x86 2 3## Error if the linked-to section of an input section is discarded. 4 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 7 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) 11 12.globl _start 13_start: 14 call .foo1 15 call bar0 16 call bar1 17 call baz0 18 call baz1 19 20.section .foo0,"a" 21.section .foo1,"a" 22 23## The linked-to section of the first input section is discarded. 24.section .bar,"ao",@progbits,.foo0,unique,0 25bar0: 26.byte 0 27.section .bar,"ao",@progbits,.foo1,unique,1 28bar1: 29.byte 1 30 31## Another case: the linked-to section of the second input section is discarded. 32.section .baz,"ao",@progbits,.foo1,unique,0 33baz0: 34.byte 0 35.section .baz,"ao",@progbits,.foo0,unique,1 36baz1: 37.byte 1 38