[cfe-dev] clang can't working on windows with mingw or msvc properly

罗勇刚(Yonggang Luo) luoyonggang at gmail.com
Wed Aug 5 08:01:04 PDT 2009


clang was compiled with msvc
I am using mingw gcc 4.4.0 comes from mingw.org

The file a.c is
#include <stdio.h>

int main()
{
	return 0;
}

But with
"D:/Tools/Building/llvm/bin/clang-cc.exe" -triple i386-pc-mingw -S
-disable-free -main-file-name a.c --relocation-model static
--disable-fp-elim --unwind-tables=0 --mcpu=pentium4 --fmath-errno=1 -v
-ID:/Tools/Building/llvm/Headers -fdiagnostics-show-option -o a.s -x c
a.c
It's generated


	.text
	.align	16
	.globl	_main
	.def	 _main;	.scl	2;	.type	32;	.endef
_main:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$4, %esp
	call	___main
	movl	$0, -4(%ebp)
	movl	$0, -4(%ebp)
	movl	-4(%ebp), %eax
	addl	$4, %esp
	popl	%ebp
	ret
g++ a.s
It's can produce a.exe properly


And also we need to add
typedef unsigned int wint_t;
into file Headers/stddef.h

It's can working with mingw:)


But with
"D:/Tools/Building/llvm/bin/clang-cc.exe" -triple i386-pc-win32 -S
-disable-free -main-file-name a.c --relocation-model static
--disable-fp-elim --unwind-tables=0 --mcpu=pentium4 --fmath-errno=1 -v
-ID:/Tools/Building/llvm/Headers -fdiagnostics-show-option -o a.s -x c
a.c
It's generated
	.686
	.MMX
	.XMM
	.model flat

	EXTERN _abort:near


	.text	ends

	.text	SEGMENT PARA 'DATA'
	public _main
	ALIGN	16
_main	proc near
	push	EBP
	mov	EBP, ESP
	sub	ESP, 4
	mov	DWORD PTR [EBP - 4], 0
	mov	DWORD PTR [EBP - 4], 0
	mov	EAX, DWORD PTR [EBP - 4]
	add	ESP, 4
	pop	EBP
	ret
_main	endp
	end

can't be compiled with ml. or I don't know how to.

-- 
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo




More information about the cfe-dev mailing list