Subject: Re: New Toolchain's gas lossage on m68k
To: None <>
From: Aaron J. Grier <>
List: tech-toolchain
Date: 11/11/2001 09:50:37
On Wed, Nov 07, 2001 at 10:36:27PM +0000, Steve Woodford wrote:

> According to comments in the source (eg. gas/config/tc-m68k.h:170),
> externally visible symbols may be overridden by shared libraries, so
> the assembler cannot do the relocation at assembly time. This bites
> m68k's relative branches because the offsets can be 8, 16 or 32-bits
> in size.

so you end up with 32-bits offset in this case...

> Presumably the assembler is doing TRT as per ELF's requirements, but
> there must be a better way to do this other than hacking our in-tree
> assembly source.
> What does gas do on other cpus with variable branch offset sizes?

I still don't understand the problem...  you're trying to force a byte
branch to an address that's more than 128 bytes away and it's breaking,
as well it should.  there's no need to specify size for branch and jump
operations for just the reasons you've illustrated, namely

1) if the location is a non-visible (local) symbol, the assembler will
   pick the smallest offset for you

2) if the location is a globally-visible symbol, the assembler has to
   make room for a 32-bit offset since it has no idea a priori if all
   locations will be within 32k of eachother.

I think maybe the linker will do relaxation of 32-bit offsets if they
are not necessary.

  Aaron J. Grier | "Not your ordinary poofy goof." |
     "No single layer of abstraction can save the world or even make
      good coffee."  --  Kevin P. Neal