Date: Wed, 4 Jul 2012 16:32:02 -0700 From: Colin Barnabas <colin.barnabas@gmail.com> To: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: GAS AT&T linkage issue Message-ID: <20120704233202.GA9910@hs1.VERBENA>
next in thread | raw e-mail | index | archive | help
I've been dabbling in assembly and decided to try AT&T syntax and the GAS assembler. I'm trying to get a cpuid test program running. It assembles fine if I give the command: as -o cpuid.o cpuid.s But starts complaining when I try to link it with: ld -o cpuid cpuid.o Which produces these errors: cpuid.o: In function `_start': (.text+0x10): undefined reference to `ebx' cpuid.o: In function `_start': (.text+0x18): undefined reference to `edx' cpuid.o: In function `_start': (.text+0x20): undefined reference to `ecx' Im running FreeBSD 9.0-RELEASE amd64 and here is the text I am using: #cpuid.s Sample program to extract the processor Vendor ID .section .data output: .ascii "The processor Vendor ID is 'xxxxxxxxxxxx'\n" .section .text .globl _start _start: movl $0, %eax cpuid movl $output, %edi movl $ebx, 28(%edi) movl $edx, 32(%edi) movl $ecx, 36(%edi) movl $4, %eax movl $1, %ebx movl $output, %ecx movl $42, %edx int $0x80 movl $1, %eax movl $0, %ebx int $0x80 Any advice would be appreciated. -- Colin Barnabas
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120704233202.GA9910>