Thread View: gnu.utils.bug
2 messages
2 total messages
Started by Andrew Smith
Mon, 03 Aug 1992 17:19
Branch addressing bug in GAS-1.92.3 / 68k
Author: Andrew Smith
Date: Mon, 03 Aug 1992 17:19
Date: Mon, 03 Aug 1992 17:19
60 lines
2127 bytes
2127 bytes
Steve(s), > In article <9207301722.AA00678@zaphod.synoptics.com> you write: > [ ... ] > >I have a GAS called gas-1.92.3 which supports all of the 68040 MMU opcodes > >but not the 68030 ones. Any ideas? > > Can't help you with the 68030 MMU stuff, but I can offer a word of > caution: Don't trust gas-1.92.3. I've noticed that in some (all?) > cases, it miscomputes offsets for relative branches. > > But don't take my word for it, try the following test case: > > > .globl test > > .text > > test: > > bnes label > > bne label > > bnel label > > nop > > label: rts > > The output of 'objdump -d' on my Sparc reads: > > > test.o: file format a.out-sunos-big > [ ... ] > > 00000000 (label-)000e bnes 0000000f (label+)0001 > > 00000002 (test+)0002 bne 00000010 (label+)0002 > > 00000006 (test+)0006 bnel 00000012 (label+)0004 > > 0000000c (test+)000c nop > > 0000000e (test+)000e rts > [ ... ] > I tried your example and you're right - so I wondered how any of my code could ever run at all! Then I thought about what it says in the manual about "Optimised Branch" instructions. If you write test: jne label jne label jne label nop label: rts You get the correct answers! Strange ..... I don't know how it can be wrong on "bne" but get a pseudo-op "jne" correct: looks like someone broke the simple case in order to get the optimisation working. I am copying this to the list and to sac@cygnus.com (I don't know if Steve Chamberlain at Cygnus looks after the 68k assembler as well as other ones but he'll know who to get to fix it!). Andrew Smith Distributed Network Systems SynOptics Communications Inc.
Re: Branch addressing bug in GAS-1.92.3 / 68k
Author: John Clark
Date: Wed, 05 Aug 1992 17:35
Date: Wed, 05 Aug 1992 17:35
48 lines
1999 bytes
1999 bytes
In article <9208031719.AA08940@zaphod.synoptics.com> asmith@synoptics.com (Andrew Smith) writes:
+
+> In article <9207301722.AA00678@zaphod.synoptics.com> you write:
+> [ ... ]
+> >I have a GAS called gas-1.92.3 which supports all of the 68040 MMU opcodes
+> >but not the 68030 ones. Any ideas?
+>
+> Can't help you with the 68030 MMU stuff, but I can offer a word of
+> caution: Don't trust gas-1.92.3. I've noticed that in some (all?)
+> cases, it miscomputes offsets for relative branches.
The following patch is offered as 'hack' solutions to the m68k branch
calculation errors I have found with gas-1.92.3.
diff -r ./gas-1.92.3/gas/config/tc-m68k.c ../gas-1.92.3/gas/config/tc-m68k.c
2034c2034,2043
< /* Needs no offsetting */
---
> #if 0
> if (((cpu_of_arch(current_architecture) < m68020) || (0 == adds(opP->con1)))
> && (the_ins.opcode[0] >= 0x6200)
> && (the_ins.opcode[0] <= 0x6f00)) {
> add_frag(adds(opP->con1),offs(opP->con1),TAB(BCC68000,SZ_UNDEF));
> } else {
> add_frag(adds(opP->con1),offs(opP->con1),TAB(BRANCH,SZ_UNDEF)); /* Needs no offsetting */
> }
> #else
> opP->con1->e_exp.X_add_number -= 1;
2035a2045
> #endif
2039c2049
< opP->con1->e_exp.X_add_number += 2;
---
> /* opP->con1->e_exp.X_add_number += 2;*/
2049c2059
< opP->con1->e_exp.X_add_number+=4;
---
> /* opP->con1->e_exp.X_add_number+=4;*/
------- END M68K hack -----------
--
John Clark
jclark@ucsd.edu
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads