reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
# REQUIRES: x86
# RUN: echo -e '.section .bss,"bw",discard,main_global\n.global main_global\n main_global:\n .long 0' | \
# RUN:     llvm-mc - -filetype=obj -o %t1.obj -triple x86_64-windows-msvc
# RUN: llvm-mc %s -filetype=obj -o %t2.obj -triple x86_64-windows-msvc

# LLD should report an error and not assert regardless of whether we are doing
# GC.

# RUN: not lld-link -entry:main -nodefaultlib %t1.obj %t2.obj -out:%t.exe -opt:ref   2>&1 | FileCheck %s
# RUN: not lld-link -entry:main -nodefaultlib %t1.obj %t2.obj -out:%t.exe -opt:noref 2>&1 | FileCheck %s

# CHECK: error: relocation against symbol in discarded section: assoc_global
# CHECK: >>> referenced by {{.*}}reloc-discarded{{.*}}.obj:(main)

	.section	.bss,"bw",discard,main_global
	.globl	main_global
	.p2align	2
main_global:
	.long	0

	.section	.CRT$XCU,"dr",associative,main_global
	.p2align	3
assoc_global:
	.quad	main_global

	.text
	.globl main
main:
	movq assoc_global(%rip), %rax
	movl (%rax), %eax
	retq