tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] asmtest.S?


From: David A. Wheeler
Subject: Re: [Tinycc-devel] asmtest.S?
Date: Sun, 06 May 2007 23:32:22 -0400 (EDT)

Rob Landley:
> Does anybody know what asmtest.S is for?  I can't find a current user of it, 
> and I suspect that A) it should be in the tests directory, B) it should be 
> hooked up to Makefile somehow.

I think your intuition is on the money.  Sure looks like a testcase to me.

But when I ran asmtest.S through tcc, 'as', and gcc in the "obvious" way, they 
ALL produced DIFFERENT disassembled results (!!).  Both gcc and 'as' (gas) 
complain about a number of the operators; they may be guessing wrong, which 
would explain why they differ from tcc.  But what's mind-boggling is that the 
disassembled assembly from 'as' and gcc differ (!) - not just in the ELF 
header, but the actual disassembled code!  Maybe gcc sets some options to 'as' 
before it's called that accounts for the gcc/'as' difference.

It'd be nice if the ASM test could compare the output generated from a 
"believed good" program when you hook it into the makefile.  I haven't had time 
to do more than notice that the outputs are different, but now you know...!

--- David A. Wheeler

==== Script to compare assembler outputs (Unix-like only) ====
./tcc -B. -I. -c -o asmtest.tcc.o asmtest.S
as -o asmtest.as.o asmtest.S
gcc -c -o asmtest.gcc.o asmtest.S  # Diff size output!
for file in asmtest.tcc.o asmtest.as.o asmtest.gcc.o
do
 objdump -d $file > $file.objdump
done
md5sum *.objdump  # Different!




=== Note that 'as' produces different output than gcc ===
-asmtest.as.o:     file format elf32-i386
+asmtest.gcc.o:     file format elf32-i386

 Disassembly of section .text:

@@ -426,80 +426,80 @@
  54d:  f4                      hlt
  54e:  9b                      fwait
  54f:  90                      nop
- 550:  67 67 f0 f3 f3 f3 f2    repz repnz lock addr16 invd
- 557:  f2 0f 08
- 55a:  0f 09                   wbinvd
...
+ 550:  f0 f3 f3 f3 f2 f2 0f    repz repnz lock invd
+ 557:  08
+ 558:  0f 09                   wbinvd
+ 55a:  0f a2                   cpuid






reply via email to

[Prev in Thread] Current Thread [Next in Thread]