This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 3.0: -m68000 -fpic generates invalid code
- To: schwab at suse dot de
- Subject: Re: gcc 3.0: -m68000 -fpic generates invalid code
- From: "Alexander Aganichev" <AAganichev at hypercom dot com>
- Date: Mon, 16 Jul 2001 20:36:03 +0400
- Cc: gcc at gcc dot gnu dot org
Adreas,
|>> gcc 3.0 generates invalid code when -m68000 -fpic options given. Here is sample test:
|>>
|>> test.c:
|>> int foo(int a);
|>> int foo2(int a) {
|>> return foo(a);
|>> }
|>>
|>> The output from compiler contains `bsr.l' instruction which is not available on m68000.
|>For which target did you configure the compiler?
I've tried both m68k-elf and m68k-coff.
|> Note that gcc does not support -fpic with -m68000 when using ELF,
I don't see any reason for that strange behaviour. There's no problem to generate proper code, just
do not add `.l' after `bsr' instruction. Something like:
if(pic == 1)
return "bsr ...";
else /* since pic == 2 is not supported on m68000 that's ok */
return "bsr.l ...";
Though the second instruction should be generated by ld's relaxer (as far as I understand the way
that gcc and binutils should interact), so the proper way to fix will be just removing `.l' after
`bsr'. But I'm not sure that everything will still works when saying this words :-)
Alexander