Error: suffix or operands invalid for `push'

Bob Plantz plantz@cds1.net
Wed Apr 8 17:27:00 GMT 2009


Oops, I think I gave an incomplete answer. I did not read the original
problem carefully.

If the 'push' instruction gives an error message, I suspect that the
program has some assembly language code in it. Otherwise, the compiler
would generate the correct sizes (32-bit or 64-bit).

If there is some assembly language, and it is written for  32-bit, it
would have to be changed to 64-bit. I am guessing that you do not want
to do that.

So, I will assume that you want to create a 32-bit program.

The '-m32' option for gcc will tell the compiler to generate 32-bit
code.

There are a couple of possibilities to cause the assembler to do 32-bit.

1. Look in your make file for an 'as' command. That is how the assembler
it invoked. The option to cause 'as' to do 32-bit is '--32'. (Yes, there
are two dashes here.)

2. If the assembly language is embedded in C/C++ code, or it's in a '.s'
file, gcc will pass it on to the assembler. You then have to tell gcc to
pass the '--32' option on to the assembler. You do that with the gcc
option 'Wa,--32'. The 'Wa' tells gcc that you have an option for the
assembler. You need to follow that with a comma and then the option,
with no spaces.

So I think you need to both (a) give gcc the -m32 option, and (b) give
the assembler the '--32' option.

Warning: This still may not work. Your installation also needs to have
the proper 32-bit libraries installed. But if they are not installed,
the errors should come during the linking phase.

Bob


On Wed, 2009-04-08 at 18:09 +0200, Riccardo FABBRIS wrote:
> Hi Bob,
> First of all thanks for replying,
> Yes, I'm using a x86-64 processor.
> As said before I'm pretty ignorant: if I had to write
> make
> how would my command become? Do I have to change the makefile?
> I tried to change
> CC := gcc
> with
> CC:= gcc -m32
> but it still not work.
> Thanks and sorry my ignorance,
> Riccardo
> 
> On Wed, 08 Apr 2009 08:42:20 -0700, Bob Plantz said:
> > 
> > Assuming that you are using an x86-64 processor, try the -m32 option for
> > gcc.
> > 
> > Bob
> > 



More information about the Gcc-help mailing list