38 lines · plain
1# REQUIRES: x862 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.o6# RUN: not ld.lld --gc-sections --print-gc-sections %t.o -o /dev/null 2>&1 | FileCheck %s7 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 _start13_start:14 call .foo115 call bar016 call bar117 call baz018 call baz119 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,025bar0:26.byte 027.section .bar,"ao",@progbits,.foo1,unique,128bar1:29.byte 130 31## Another case: the linked-to section of the second input section is discarded.32.section .baz,"ao",@progbits,.foo1,unique,033baz0:34.byte 035.section .baz,"ao",@progbits,.foo0,unique,136baz1:37.byte 138