This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
AMD 64 Problem with assembling
- From: Florian Michel <florian__michel at web dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 09 Jul 2005 23:23:05 +0200
- Subject: AMD 64 Problem with assembling
Hello,
I have a question concerning successfully assembling and linking the following assembly program on a linux AMD 64 machine:
#cpuid2.s View the CPUID Vendor ID string using C library calls
.section .datatext
output:
.asciz "The processor Vendor ID is '%s'\n"
.section .bss
.lcomm buffer, 12
.section .text
.globl main
main:
movl $0, %eax
cpuid
movl $buffer, %edi
movl %ebx, (%edi)
movl %edx, 4(%edi)
movl %ecx, 8(%edi)
push $buffer
push $output
call printf
addl $8, %esp
push $0
call exit
This part of a book on assembly programming I am reading.
Compile and Link: gcc -o cpuid2 cpuid2.s
When running cpuid2 it crashes with a segmentation fault.
Which switches do I have to add to call gcc?
Thanks a lot!
Greetings,
Florian