PDA

View Full Version : GAS and 64-bit integers on i386 (mingw)


rpgfan3233
06-30-2006, 09:10 PM
Okay, I'm a bit confused with how to use GAS and 64-bit integers (long long int) with an i386 machine. I understand the optimized code generated from gcc (below), but I can't figure out how to use my own quadword by declaring it. Here is the code using "gcc -S -Os x.c":
.file "x.c"
.def ___main; .scl 2; .type 32; .endef
.section .rdata,"dr"
LC0:
.ascii "%I64X\0"
.text
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
pushl %ebp
movl %esp, %ebp
call ___main
pushl $239
pushl $-1
pushl $LC0
call _printf
xorl %eax, %eax
leave
ret
.def _printf; .scl 2; .type 32; .endef


I know I can do something like
myX:
.quad 0xEFFFFFFFFF


But how do I use that in my 32-bit code? Even a simple example like the following would be fine:

myX:
.long 0xEFFFFFFF
LC0:
.ascii "%X\0"
.text
.globl _main
_main:
movl $myX, %edx
pushl (%edx)
pushl $LC0
call _printf
ret