[LLVMdev] x86 asm dllexport output for mingw targets

Alen Skondro askondro at gmail.com
Tue Feb 7 02:25:27 PST 2012


It seems that the DLL export directives for __cdecl and __stdcall 
functions are not correctly written in asm output.

For example, when declaring a function like this:

__declspec(dllexport) int __cdecl exportFunc1(int c);


ASM output is:


	.def	 _exportFunc1;
	.scl	2;
	.type	32;
	.endef
	.text
	.globl	_exportFunc1
	.align	16, 0x90
_exportFunc1:
	movl	4(%esp), %eax
	ret


	.section	.drectve,"r"
	.ascii	 " -export:_exportFunc1"



GNU assembler fails with the message that it can't find the symbol 
_exportFunc1. When removing the leading underscores
("-export:exportFunc1") GAS is happy. This is also how GCC for mingw 
behaves.
I can write a small patch for this but I just wanted to know if I am on 
the right path ...



More information about the llvm-dev mailing list