Path: utzoo!utgpu!watmath!watdragon!rose!ccplumb From: ccplumb@rose.waterloo.edu (Colin Plumb) Newsgroups: gnu.gcc.bug Subject: Re: (none) Message-ID: <17555@watdragon.waterloo.edu> Date: 26 Oct 89 02:11:30 GMT References: <8910242353.AA17160@tpl68k0> Sender: daemon@watdragon.waterloo.edu Reply-To: ccplumb@rose.waterloo.edu (Colin Plumb) Distribution: gnu Organization: U. of Waterloo, Ontario Lines: 130 In article <8910242353.AA17160@tpl68k0> paulg@tplrd.tpl.oz.au (Paul Gittings) writes: > I have had the following problem (bug?) with version 1.32 of GNU CC on > an ISI 68020 system. > > When I compile a program with the -m68000 flag, 68020 machine code is still > produced. NOTE: by using the -v flag I can see that the -m68000 flag > is not being passed to the assembler (GAS 1.27). If I compile and > assemble separately, using the -m68000 flag in each step, the correct code > is produced. More details, for those wizardly enough to attempt a fix (or definitively say the behaviour is a feature, or fixed in 1.36, or some such): > RE: my bug report of a few days ago. > > Sorry about the shortage of info. with the original bug report, things > are a bit busy right now. > > To re-iterate it seems that when I use the -m68000 flag with gnu-cc > it does not guarantee 68000 code, I claim I still see 68020 in the output. > Note, this problem seems to disappear if I compile to a .s file and then > assemble the .s to .o file using the -m68000 flag with gas. > > The GNU CC I'm using was built using the config files selected by the > script config.gcc with the argument isi68. > > What follows is a sample C program, the script I used to compile and > to do a hex dump on the object file, and output from a run of the script file. > NOTE: the file is compiled twice by the script and you should > note that the output is different: the first is the one causing me problems > the second is my work around i.e. I have a separate call to gnu-gas which > uses the -m68000, I haven't done very extensive testing of the "work around" > so it may just work in the very limited c programs I've tried to compile to > 68000 code. > > I hope I'm not wasting your time by having done something really stupid. > Thanks for your help, > Paul Gittings Here is the C file called gnu_bug.c -------------------------------------------------------------------- extern void test3(); void test1() { test3(); } -------------------------------------------------------------------- Here is the Script file that generates the output below -------------------------------------------------------------------- echo "****** Compile and assemble in one go. Output = bug.o" echo /@tpl68k0/usr/local/gnu/bin/gcc -v -msoft-float gnu_bug.c -c -m68000 -o bug.o echo echo "****** Dump of object file: bug.o" od -x bug.o echo echo "****** Compile and assemble separately. Output = good.o" /@tpl68k0/usr/local/gnu/bin/gcc -v -S -msoft-float gnu_bug.c -c -m68000 /@tpl68k0/usr/local/gnu/lib/gcc-as -v -m68000 gnu_bug.s -o good.o echo echo "****** Dump of object file: good.o" od -x good.o echo echo "****** Why does the output differ?" diff bug.o good.o --------------------------------------------------------------------- Here is the output from a run of the above script file --------------------------------------------------------------------- ****** Compile and assemble in one go. Output = bug.o gcc version 1.35 /usr/local/gnu/lib/gcc-cpp -v -undef -D__GNUC__ -Dunix -Dmc68000 -Dis68k -D__unix__ -D__mc68000__ -D__is68k__ gnu_bug.c /tmp/cc015443.cpp GNU CPP version 1.32 /usr/local/gnu/lib/gcc-cc1 /tmp/cc015443.cpp -quiet -dumpbase gnu_bug.c -msoft-float -m68000 -version -o /tmp/cc015443.s GNU C version 1.32 (68k, MIT syntax) compiled by CC. /usr/local/gnu/lib/gcc-as -o bug.o /tmp/cc015443.s ****** Dump of object file: bug.o 0000000 0000 0107 0000 0010 0000 0000 0000 0000 0000020 0000 0030 0000 0000 0000 0008 0000 0000 0000040 4e56 0000 61ff ffff fffa 4e5e 4e75 0000 0000060 0000 0006 0000 03d0 0000 0004 0100 0000 0000100 0000 0000 0000 000c 0400 0000 0000 0000 0000120 0000 001a 0500 0000 0000 0000 0000 0021 0000140 0100 0000 0000 0000 0000 0028 666c 7475 0000160 7365 6400 6763 635f 636f 6d70 696c 6564 0000200 2e00 5f74 6573 7431 005f 7465 7374 3300 0000220 ****** Compile and assemble separately. Output = good.o gcc version 1.35 /usr/local/gnu/lib/gcc-cpp -v -undef -D__GNUC__ -Dunix -Dmc68000 -Dis68k -D__unix__ -D__mc68000__ -D__is68k__ gnu_bug.c /tmp/cc015453.cpp GNU CPP version 1.32 /usr/local/gnu/lib/gcc-cc1 /tmp/cc015453.cpp -quiet -dumpbase gnu_bug.c -msoft-float -m68000 -version -o gnu_bug.s GNU C version 1.32 (68k, MIT syntax) compiled by CC. Gnu assembler version 1.28 (I guess.) ****** Dump of object file: good.o 0000000 0000 0107 0000 0010 0000 0000 0000 0000 0000020 0000 0030 0000 0000 0000 0008 0000 0000 0000040 4e56 0000 4eb9 0000 0000 4e5e 4e75 0000 0000060 0000 0006 0000 0350 0000 0004 0100 0000 0000100 0000 0000 0000 000c 0400 0000 0000 0000 0000120 0000 001a 0500 0000 0000 0000 0000 0021 0000140 0100 0000 0000 0000 0000 0028 666c 7475 0000160 7365 6400 6763 635f 636f 6d70 696c 6564 0000200 2e00 5f74 6573 7431 005f 7465 7374 3300 0000220 ****** Why does the output differ? Binary files bug.o and good.o differ ----------------------------------------------------------------------------- NOTE: the object files differ at bytes 44-49 bug.o 0000045 61ff - this is a 68020 instruction a BSR with 32 bit displacement which is not supported on the 68000 good.o 0000045 45b6 - this is a JSR to an absolute 32 bit address which is supported by the 68000