This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 32-bit libraries in 64-bit build.


On Wed, 2009-05-20 at 12:31 -0400, Michael Meissner wrote:

> structures as well.  64 and 32-bit programs use a completely different ABI, and
> the stack is set up differently.

The main difference being that the first six arguments are passed in
registers instead of on the stack. It's very "RISC-like."


>   Finally, some 32-bit instruction encodings
> are not available when the computer is in 64-bit mode, and others behave
> differently when the 64-bit registers are enabled.
> 

Isn't this true only at the individual instruction level?

For example, you can do
    movb    %ah, %al    # 32-bit, no REX prefix byte
    movb    %al, %r8b   # 64-bit, requires REX prefix byte

but you cannot do
    movb    %ah, %r8b   # mixed mode, conflict

The first sequence of instructions will run on my machine under 64-bit
Ubuntu.

An aside: The gnu assembler, gas, gives an error message about the REX
prefix being required for the second case. It took me a while to figure
it out. The error message should really say something about this being
an attempt to mix 32-bit and 64-bit modes.

Bob




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]