Date: Wed, 29 Mar 2000 21:09:45 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Matthew Dillon <dillon@apollo.backplane.com> Cc: Gary Jennejohn <garyj@muc.de>, freebsd-current@FreeBSD.ORG Subject: Re: Very weird assembly failure (was Re: UP kernel performance and Matt Dillon's patches) Message-ID: <Pine.BSF.4.21.0003292043500.1764-100000@alphplex.bde.org> In-Reply-To: <200003290348.TAA56657@apollo.backplane.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 28 Mar 2000, Matthew Dillon wrote: > I found a couple of minor nits, but only one real bug. In i386/swtch.s > I forgot to change out a WANT_RESCHED for AST_RESCHED: > > sw1a: > call _chooseproc /* trash ecx, edx, ret eax*/ > testl %eax,%eax > CROSSJUMP(je, _idle, jne) /* if no proc, idle */ > movl %eax,%ecx > > xorl %eax,%eax > andl $~WANT_RESCHED,_astpending > > The problem is that a kernel build is not reporting any errors! > WANT_RESCHED does not exist at all, anywhere. If I change it to > a garbage name the kernel still builds. I don't get it. It seems to be a gas bug. The error is detected if ~WANT_RESCHED is replaced by WANT_RESCHED. ~WANT_RESCHED is no a simple relocatable expression, so it isn't clear that gas or elf can handle it. They don't seem to for the following simpler case: $ echo "movl $~FOO,%eax" >z.s $ echo ".globl foo; .set FOO,0x55555555" >z1.s $ cc -c z.s z1.s $ ld -o z z.o z1.s $ objdump --disassemble z z: file format elf32-i386 Disassembly of section .text: 08048074 <.text>: 8048074: b8 ff ff ff ff movl $0xffffffff,%eax ^^^^^^^^ should be aaaaaaaa but still has best guess at time of assembly of z.s 8048079: 90 nop 804807a: 90 nop 804807b: 90 nop Everthing works right for "FOO" instead of ~FOO. The aout case gets this wrong in a more obvious way. Gas produces the same code for "movl $~FOO,%eax" as for "movl $FOO,%eax". Linking to z1.o then gives the right value for $FOO and the wrong value for $~FOO. Gas notices the problem for "movl $-FOO,%eax": z.s: Assembler messages: z.s:1: Error: Negative of non-absolute symbol FOO Similarly for the a.out case. Complementation is equivalent to negation on 2's complement machines, so gas should produce this error for $~FOO too. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0003292043500.1764-100000>