xref: /llvm-project/lld/test/COFF/comdat-drectve.s (revision 503bc5f66111f7e4fc79972bb9bfec8bb5606bab)
1# REQUIRES: x86
2
3# RUN: llvm-mc -triple=x86_64-windows-gnu %s -filetype=obj -o %t.obj
4
5# RUN: lld-link %t.obj -out:%t.exe -debug:symtab -subsystem:console
6# RUN: llvm-readobj --coff-exports %t.exe | FileCheck %s
7
8# CHECK: Name: exportedFunc
9
10## This assembly snippet has been reduced from what Clang generates from
11## this C snippet, with -fsanitize=address. Normally, the .drectve
12## section would be a regular section - but when compiled with
13## -fsanitize=address, it becomes a comdat section.
14##
15# void exportedFunc(void) {}
16# void mainCRTStartup(void) {}
17# static __attribute__((section(".drectve"), used)) const char export_chkstk[] =
18#     "-export:exportedFunc";
19
20	.text
21	.globl	exportedFunc
22exportedFunc:
23	retq
24
25	.globl	mainCRTStartup
26mainCRTStartup:
27	retq
28
29	.section	.drectve,"dr",one_only,export_chkstk
30export_chkstk:
31	.asciz	"-export:exportedFunc"
32