Re: Porting windows app to OS X and it's extremely huge as a result
Re: Porting windows app to OS X and it's extremely huge as a result
- Subject: Re: Porting windows app to OS X and it's extremely huge as a result
- From: Jason Stephenson <email@hidden>
- Date: Sat, 24 May 2008 10:58:31 -0400
Platon Fomichev wrote:
Dear Jon
Well sure I did this and many more. Let's see simple example:
int main()
{
char test[65000] = {0};
test[0] = 0; /* To avoid any possible optimization of unused vars */
return 0;
}
stauff:~ stauff$ gcc -O0 -s -fzero-initialized-in-bss test.c
stauff:~ stauff$ ls -l a.out
-rwxr-xr-x 1 stauff stauff 78720 May 24 18:23 a.out
Wohoo wooping 78K
What compiler are you using and what platform are you on? I've got Xcode
3.0 on Leopard Intel and using gcc4.1, I get the following:
bash-3.2$ gcc -O0 -s -fzero-initialized-in-bss test.c
ld64: warning: option -s is obsolete and being ignored
bash-3.2$ ls -l a.out
-rwxr-xr-x 1 jason staff 12492 May 24 10:48 a.out
When using -S for assembly output, it looks like this:
.text
.globl _main
_main:
pushl ëp
movl %esp, ëp
subl $65032, %esp
leal -65008(ëp), íx
movl $65000, êx
movl êx, 8(%esp)
movl $0, 4(%esp)
movl íx, (%esp)
call L_memset$stub
movb $0, -65008(ëp)
movl $0, êx
leave
ret
.section
__IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5
L_memset$stub:
.indirect_symbol _memset
hlt ; hlt ; hlt ; hlt ; hlt
.subsections_via_symbols
Suffice it to say, it looks like -fzero-initialized-in-bss is working
with gcc4.1.
If looking at disassembly it will be like this:
_C.0.1461:
.space 65000
.text
And later memcpy - I looked at FreeBSD asm output and it was simple memset.
Best regards,
Stauff__
On May 24, 2008, at 18:15 PM, Jon Gotow wrote:
zero-initialized-in-bss
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden