]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/COFF/reloc-discarded.s
Vendor import of lld trunk r338150:
[FreeBSD/FreeBSD.git] / test / COFF / reloc-discarded.s
1 # REQUIRES: x86
2 # RUN: echo -e '.section .bss,"bw",discard,main_global\n.global main_global\n main_global:\n .long 0' | \
3 # RUN:     llvm-mc - -filetype=obj -o %t1.obj -triple x86_64-windows-msvc
4 # RUN: llvm-mc %s -filetype=obj -o %t2.obj -triple x86_64-windows-msvc
5
6 # LLD should report an error and not assert regardless of whether we are doing
7 # GC.
8
9 # RUN: not lld-link -entry:main -nodefaultlib %t1.obj %t2.obj -out:%t.exe -opt:ref   2>&1 | FileCheck %s
10 # RUN: not lld-link -entry:main -nodefaultlib %t1.obj %t2.obj -out:%t.exe -opt:noref 2>&1 | FileCheck %s
11
12 # CHECK: error: relocation against symbol in discarded section: assoc_global
13
14         .section        .bss,"bw",discard,main_global
15         .globl  main_global
16         .p2align        2
17 main_global:
18         .long   0
19
20         .section        .CRT$XCU,"dr",associative,main_global
21         .p2align        3
22 assoc_global:
23         .quad   main_global
24
25         .text
26         .globl main
27 main:
28         movq assoc_global(%rip), %rax
29         movl (%rax), %eax
30         retq