1// REQUIRES: x86
2// RUN: split-file %s %t
3// RUN: llvm-mc -filetype=obj -triple=x86_64 %t/asm -o %t.o
4// RUN: ld.lld -T %t/lds %t.o -o %t.exe 2>&1 | FileCheck %s
5// CHECK:      warning: {{.*}}.o:(.nonalloc1+0x1): has non-ABS relocation R_X86_64_PC32 against symbol '_start'
6// CHECK-NEXT: warning: {{.*}}.o:(.nonalloc1+0x6): has non-ABS relocation R_X86_64_PC32 against symbol '_start'
7
8// RUN: llvm-objdump -D --no-show-raw-insn %t.exe | FileCheck --check-prefix=DISASM %s
9// DISASM:      Disassembly of section .nonalloc:
10// DISASM-EMPTY:
11// DISASM-NEXT: <.nonalloc>:
12// DISASM-NEXT:   0: nop
13// DISASM-NEXT:   1: callq 0x0
14// DISASM-NEXT:   6: callq 0x0
15
16//--- lds
17SECTIONS {
18  .nonalloc 0 : { *(.nonalloc*) }
19}
20//--- asm
21.globl _start
22_start:
23  nop
24
25.section .nonalloc0
26  nop
27
28.section .nonalloc1
29  .byte 0xe8
30  .long _start - . - 4
31  .byte 0xe8
32  .long _start - . - 4
33