public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* AMD 64 Problem with assembling
@ 2005-07-09 21:23 Florian Michel
  2005-07-10 16:29 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Michel @ 2005-07-09 21:23 UTC (permalink / raw)
  To: gcc-help


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

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

end of thread, other threads:[~2005-07-10 16:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-09 21:23 AMD 64 Problem with assembling Florian Michel
2005-07-10 16:29 ` Ian Lance Taylor

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