150
|
1 # REQUIRES: x86
|
|
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
|
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/comdat-discarded-reloc.s -o %t2.o
|
|
4 # RUN: ld.lld -gc-sections --noinhibit-exec %t2.o %t.o -o /dev/null
|
|
5 # RUN: ld.lld -r %t2.o %t.o -o %t 2>&1 | FileCheck --check-prefix=WARN %s
|
|
6 # RUN: llvm-readobj -r %t | FileCheck --check-prefix=RELOC %s
|
|
7
|
|
8 ## ELF spec doesn't allow a relocation to point to a deduplicated
|
|
9 ## COMDAT section. Unfortunately this happens in practice (e.g. .eh_frame)
|
|
10 ## Test case checks we do not crash.
|
|
11
|
|
12 # WARN: warning: relocation refers to a discarded section: .text.bar1
|
|
13 # WARN-NEXT: >>> referenced by {{.*}}.o:(.rela.text.bar2+0x0)
|
|
14 # WARN-NOT: warning
|
|
15
|
|
16 # RELOC: .rela.eh_frame {
|
|
17 # RELOC-NEXT: R_X86_64_NONE
|
|
18 # RELOC-NEXT: }
|
|
19 # RELOC-NEXT: .rela.debug_foo {
|
|
20 # RELOC-NEXT: R_X86_64_NONE
|
|
21 # RELOC-NEXT: }
|
|
22 # RELOC-NEXT: .rela.gcc_except_table {
|
|
23 # RELOC-NEXT: R_X86_64_NONE
|
|
24 # RELOC-NEXT: }
|
|
25
|
|
26 .section .text.bar1,"aG",@progbits,group,comdat
|
|
27
|
|
28 ## .text.bar1 in this file is discarded. Warn on the relocation.
|
|
29 .section .text.bar2,"ax"
|
|
30 .globl bar
|
|
31 bar:
|
|
32 .quad .text.bar1
|
|
33
|
|
34 ## Don't warn on .eh_frame, .debug*, .zdebug*, or .gcc_except_table
|
173
|
35 .section .eh_frame,"a",@unwind
|
150
|
36 .quad .text.bar1
|
|
37
|
|
38 .section .debug_foo
|
|
39 .quad .text.bar1
|
|
40
|
|
41 .section .gcc_except_table,"a"
|
|
42 .quad .text.bar1
|