From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 4 23:30:50 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0683A106566B for ; Wed, 4 Jul 2012 23:30:50 +0000 (UTC) (envelope-from colin.barnabas@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id CF0D68FC0A for ; Wed, 4 Jul 2012 23:30:49 +0000 (UTC) Received: by pbbro2 with SMTP id ro2so12740436pbb.13 for ; Wed, 04 Jul 2012 16:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=SosUdCZf+4yFAN1gkM/pCRA23p3ltze2XlncwNxbQ3Q=; b=MX7ArSxN6ZgkpL4MD4V+G6oIiahamiRg/xxZwEfkH64vhQJV+XFgJoEomzaWuXR5JD Ejq5WFyKLGIuHN6J3pScPz9DIVdiRn6rOtnZeNjqTzjh6t+Q6rgnwEAgjtR/q2+UGVLy pXrPLOY9qORNiHVX3dTWQDzoj2mYHejk67y/clwXoivx9RyN7n5rhLv2gd3q8rqaHhli AopLsbox+544KHDDuWz8v2Eyt/z8ZCGZbMhbiIh0LBX4ANU9h8g4ks6nlPOLR1iJpL+N wWuVYzvxxsevzxAQjkT/gEnmDlhEJlKJnx4dQCbBo/ezFZ2OZiYFaOTGXZjXx7SCXCmH zzoA== Received: by 10.68.222.163 with SMTP id qn3mr22948075pbc.135.1341444648720; Wed, 04 Jul 2012 16:30:48 -0700 (PDT) Received: from localhost (ip68-98-76-182.ph.ph.cox.net. [68.98.76.182]) by mx.google.com with ESMTPS id ms1sm18504062pbb.63.2012.07.04.16.30.47 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 04 Jul 2012 16:30:48 -0700 (PDT) Date: Wed, 4 Jul 2012 16:32:02 -0700 From: Colin Barnabas To: FreeBSD Hackers Message-ID: <20120704233202.GA9910@hs1.VERBENA> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Subject: GAS AT&T linkage issue X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 23:30:50 -0000 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