bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

offset calculation bug(?) in GNU as 2.13.2.1 for v850e


From: Miles Bader
Subject: offset calculation bug(?) in GNU as 2.13.2.1 for v850e
Date: 14 Jul 2003 19:00:04 +0900

Hi,

I'm using GNU as from the binutils version 2.13.2.1, cross-compiling
with target = v850e-elf and host = i386-pc-linux-gnu.

When I assemble the following file (called bug.s):

           .text
   start:
           di
           mov     hilo(_init_stack_end - 4), sp
           mov     hilo(mach_early_init), r6
           cmp     r6, r0
           bz      3f
           jarl    2f, lp
   2:      add     3f - ., lp
           jmp     [r6]
   3:

using the command `v850e-elf-as bug.s', I get the error output:

   bug.s: Assembler messages:
   bug.s:9: Warning: operand out of range (-20 not between -16 and 15)

... and indeed the emitted machine code for line 9 (the `add' insn) is
wrong -- I want a value of 4 for the expression `3f - .', but instead I
get 12 (which is the lower 5 bits of -20).

Some more data points:

 * This code used to assemble and work properly with GNU as from a few
   years ago (I'm not sure the exact version, as that was some weird
   release from NEC/Cygnus -- the version number given by --version is
   2.9-v850ice-000414-nmit-20010327).

 * Oddly, all of the lines in the above example seem to be necessary --
   if I delete any of the (apparently extraneous to the bug) lines
   before the jarl/add, it starts working properly!

 * I tried to change the expression to `3f - 2f', but that yields the
   same result (error msg + offset of 12).

In this particular code, I can just hardwire the constant since I know
the size of the jmp insn, but I suppose in some applications it wouldn't
be so easy.

Any ideas?

Thanks,

-Miles
-- 
"1971 pickup truck; will trade for guns"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]