1# REQUIRES: x86
2
3## On RELA targets, r_addend may be updated for --emit-relocs.
4## With ICF, merged sections do not have output sections assigned.
5## Test we don't crash.
6
7# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
8# RUN: ld.lld --gc-sections --emit-relocs --icf=all %t.o -o %t
9# RUN: llvm-readobj -r %t | FileCheck %s
10
11# CHECK:      Relocations [
12# CHECK-NEXT:   Section (3) .rela.text {
13# CHECK-NEXT:     R_X86_64_64 .text 0x11
14# CHECK-NEXT:     R_X86_64_64 .text 0x11
15# CHECK-NEXT:     R_X86_64_64 .rodata 0x0
16# CHECK-NEXT:   }
17# CHECK-NEXT: ]
18
19.rodata
20quux:
21.quad 0xfe
22
23.section .text.foo,"ax"
24foo:
25.quad quux
26
27.section .text.bar,"ax"
28bar:
29.quad quux
30
31.section .text.baz,"ax"
32baz:
33.quad quux
34
35.text
36.quad foo
37.quad bar
38
39.global _start
40_start:
41  nop
42