Robert Connolly wrote:
> On Tuesday May 29 2007 12:14:59 am George Boudreau wrote:
>> Robert Connolly wrote:
>>> Cool, thanks. Btw, does nasm generally make smaller programs? The nasm
>>> version, with the extra options, is only about 7 bytes larger.
>> When I built dd.asm with the following
>> nasm -o dd.o -f aout dd.asm -l dd.lst
>>
>> ld -o dd dd.o
>>
>> strip dd
>> the final size was 976 so I see a 92 byte difference. How did you build
>> yours?
>>
>> The attachment is a commented version with a different build method.
>> m4 dd.m4 > tmp.s
>>
>> gcc -c tmp.s
>>
>> ld -o dd tmp.o
>>
>> strip dd
>> output is the same 884b
>>
>>> robert
>
> The asmutils Makefile uses:
> nasm -w+orphan-labels -w+macro-params -i../inc/ -O99v -f
> bin -D__LINUX__ -D__KERNEL__=24 -D__SYSCALL__=__S_KERNEL__
> -D__OPTIMIZE__=__O_SIZE__ -D__ELF__ -D__ELF_MACROS__
> dd.asm
>
> This makes a 871 byte 'dd'.
I ended with the same byte count.
>
> I build yours with:
> gcc -nostdlib dd.s -o dd-gnu
> strip dd-gnu
>
I still get 884 with this build method.
> And it's 916 bytes. A 45 byte difference. I'm not sure how I got a 7 byte
> difference before. The size is the same if I use 'as' and 'ld', instead
> of 'gcc'.
>
The __OPTIMIZE__ switch has an impact.
When I change it to __O_SPEED__ I get 917b cnt for dd
When I change the text message to the one in dd.s
890b cnt for dd (getting closer)
I also noticed the resulting executable from dd.asm cannot be
'dumped' with objdump and 'file dd' shows a corrupted header. Obviously
these tools cannot be run against a 'bin' format file.
-f bin is a more compact output format.
I will look at the listing as see how they 'optimize' for size but it
will take a while the listing file is almost 500k
George.
> robert
>
--
http://linuxfromscratch.org/mailman/listinfo/hlfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page