xref: /llvm-project/lld/test/ELF/comdat-discarded-error.s (revision e6aebff67426fa0f9779a0c19d6188a043bf15e7)
1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t1.o
3# RUN: echo '.section .text.foo,"axG",@progbits,foo,comdat; .globl foo; foo:' |\
4# RUN:   llvm-mc -filetype=obj -triple=x86_64 - -o %t2.o
5# RUN: echo '.weak foo; foo: .section .text.foo,"axG",@progbits,foo,comdat; .globl bar; bar:' |\
6# RUN:   llvm-mc -filetype=obj -triple=x86_64 - -o %t3.o
7
8# RUN: not ld.lld --threads=1 %t2.o %t3.o %t1.o -o /dev/null 2>&1 | FileCheck %s
9
10# CHECK:      error: relocation refers to a symbol in a discarded section: bar
11# CHECK-NEXT: >>> defined in {{.*}}3.o
12# CHECK-NEXT: >>> section group signature: foo
13# CHECK-NEXT: >>> prevailing definition is in {{.*}}2.o
14# CHECK-NEXT: >>> or the symbol in the prevailing group {{.*}}
15# CHECK-NEXT: >>> referenced by {{.*}}1.o:(.text+0x1)
16
17# CHECK:      error: relocation refers to a discarded section: .text.foo
18# CHECK-NEXT: >>> defined in {{.*}}1.o
19# CHECK-NEXT: >>> section group signature: foo
20# CHECK-NEXT: >>> prevailing definition is in {{.*}}2.o
21# CHECK-NEXT: >>> referenced by {{.*}}1.o:(.data+0x0)
22
23.globl _start
24_start:
25  jmp bar
26
27.section .text.foo,"axG",@progbits,foo,comdat
28.globl foo
29foo:
30.data
31  .quad .text.foo
32