public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Error: suffix or operands invalid for `push'
@ 2011-06-02 20:14 asura10
  2011-06-02 20:26 ` Ian Lance Taylor
  2011-06-02 20:32 ` asura10
  0 siblings, 2 replies; 6+ messages in thread
From: asura10 @ 2011-06-02 20:14 UTC (permalink / raw)
  To: gcc-help


Hi All,
  I just tried executing a normal hello world C program and got the
following error

/tmp/cc2jcOrX.s: Assembler messages:
/tmp/cc2jcOrX.s:12: Error: suffix or operands invalid for `push'
/tmp/cc2jcOrX.s:16: Error: suffix or operands invalid for `push'
/tmp/cc2jcOrX.s:24: Error: suffix or operands invalid for `pop'

I'm running on a 64-bit server

Thanks in advance

-- 
View this message in context: http://old.nabble.com/Error%3A-suffix-or-operands-invalid-for-%60push%27-tp31760683p31760683.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error: suffix or operands invalid for `push'
  2011-06-02 20:14 Error: suffix or operands invalid for `push' asura10
@ 2011-06-02 20:26 ` Ian Lance Taylor
  2011-06-02 20:32 ` asura10
  1 sibling, 0 replies; 6+ messages in thread
From: Ian Lance Taylor @ 2011-06-02 20:26 UTC (permalink / raw)
  To: asura10; +Cc: gcc-help

asura10 <surajtaurus@gmail.com> writes:

>   I just tried executing a normal hello world C program and got the
> following error
>
> /tmp/cc2jcOrX.s: Assembler messages:
> /tmp/cc2jcOrX.s:12: Error: suffix or operands invalid for `push'
> /tmp/cc2jcOrX.s:16: Error: suffix or operands invalid for `push'
> /tmp/cc2jcOrX.s:24: Error: suffix or operands invalid for `pop'
>
> I'm running on a 64-bit server

This normally means that gcc is invoking the wrong assembler for some
reason, or passing it the wrong options.  Send us gcc -v output.  Also
tell us the command line that fails, and what system you are running on,
and what version of gcc you are using.

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error: suffix or operands invalid for `push'
  2011-06-02 20:14 Error: suffix or operands invalid for `push' asura10
  2011-06-02 20:26 ` Ian Lance Taylor
@ 2011-06-02 20:32 ` asura10
  2011-06-03  5:46   ` Ian Lance Taylor
  1 sibling, 1 reply; 6+ messages in thread
From: asura10 @ 2011-06-02 20:32 UTC (permalink / raw)
  To: gcc-help



asura10 wrote:
> 
> Hi All,
>   I just tried executing a normal hello world C program and got the
> following error
> 
> /tmp/cc2jcOrX.s: Assembler messages:
> /tmp/cc2jcOrX.s:12: Error: suffix or operands invalid for `push'
> /tmp/cc2jcOrX.s:16: Error: suffix or operands invalid for `push'
> /tmp/cc2jcOrX.s:24: Error: suffix or operands invalid for `pop'
> 
> I'm running on a 64-bit server
> 
> Thanks in advance
> 
> 






Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1g/specs
gcc version 2.95.1g 19990816 (change 108897)


Linux 2.6.18-8.el5
x86_64 x86_64 x86_64 GNU/Linux

just ran a hello world program
gcc hello.c (just prints hello world)



-- 
View this message in context: http://old.nabble.com/Error%3A-suffix-or-operands-invalid-for-%60push%27-tp31760683p31760821.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error: suffix or operands invalid for `push'
  2011-06-02 20:32 ` asura10
@ 2011-06-03  5:46   ` Ian Lance Taylor
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Lance Taylor @ 2011-06-03  5:46 UTC (permalink / raw)
  To: asura10; +Cc: gcc-help

asura10 <surajtaurus@gmail.com> writes:

> Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1g/specs
> gcc version 2.95.1g 19990816 (change 108897)

This gcc is over 10 years old.  Do you really want to be doing that?

gcc 2.95.1 didn't support x86_64, so it is generating 32-bit x86 code.
Your system assembler probably defaults to 64-bit mode.  You're going to
have to modify your gcc sources to pass the -32 option to the assembler,
or convince it to use an assembler which is a simple shell script which
invokes the real assembler with the -32 option.

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error: suffix or operands invalid for `push'
  2009-04-08 16:09 ` Error: suffix or operands invalid for `push' Riccardo FABBRIS
@ 2009-04-08 17:27   ` Bob Plantz
  0 siblings, 0 replies; 6+ messages in thread
From: Bob Plantz @ 2009-04-08 17:27 UTC (permalink / raw)
  To: Riccardo FABBRIS; +Cc: gcc-help

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
> > 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error: suffix or operands invalid for `push'
  2009-04-08 15:42 Error: suffix or operands invalid for `push'" on 64bit boxes Bob Plantz
@ 2009-04-08 16:09 ` Riccardo FABBRIS
  2009-04-08 17:27   ` Bob Plantz
  0 siblings, 1 reply; 6+ messages in thread
From: Riccardo FABBRIS @ 2009-04-08 16:09 UTC (permalink / raw)
  To: Bob Plantz; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 956 bytes --]

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
> 
> 
> On Wed, 2009-04-08 at 17:08 +0200, Riccardo FABBRIS wrote:
> > Hi all,
> > I'm newbie with programming and compiling and I need a help.
> > I had an error pretty common (the one written as object) installing a 
> program on a computer, but, with the same compiler (gcc-4.1) and using the 
> same process I didn't had it on a previous computer.
> > Looking on forums I understood is a problem of gcc 64 bits.
> > How can I change my compiler to 32 bits?
> > Thanks everybody
> > Riccardo
> 
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-06-03  5:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-02 20:14 Error: suffix or operands invalid for `push' asura10
2011-06-02 20:26 ` Ian Lance Taylor
2011-06-02 20:32 ` asura10
2011-06-03  5:46   ` Ian Lance Taylor
  -- strict thread matches above, loose matches on Subject: below --
2009-04-08 15:42 Error: suffix or operands invalid for `push'" on 64bit boxes Bob Plantz
2009-04-08 16:09 ` Error: suffix or operands invalid for `push' Riccardo FABBRIS
2009-04-08 17:27   ` Bob Plantz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).