libiberty and m68k-coff?

Michael Schwingen
Wed Jul 14 12:36:00 GMT 1999

On Tue, Jul 13, 1999 at 02:42:05PM -0700, Aaron J. Grier wrote:
> I'm trying to move a bunch of code [1] from the Sierra [2] compiler
> running under DOS to the GNU toolchain.  The Sierra tools generate
> assembly code which makes global variable references against register
> a5, all the assembly is written with this in mind, and aside from going
> through all the assembly and taking out a5 references [3], I'm looking
> for better ways of moving the code over. [4]

Depending on how the assembly code addresses these variables, you might be
able to simply let gcc produce absolute references and leave the assembler
code as is, provided you intialize a5 to some valid base address so that the
same variables are accessed.

> I really don't need PIC code, as I'm running on an embedded system.  The
> original reason (so I've been told) for doing a5-relative stuff was
> because PIC was needed for a monitor which never got written.  (Is PIC a
> necessity for BDM?)

I don't think so. It might be useful for an in-target monitor that runs from
ROM or RAM and is moved around depending on hardware - I could have needed
this once in a system where the monitor code had to be at the top of RAM,
while the amount of RAM was variable, so I could not use the normal
m68k-coff-linker to place the code at a fixed absolute address.

(no, we did not solve this but rather circumvented it).

> [4] I'm still having to go through a heck of a lot of assembly code
>     by hand due to the strange sierra assembly preprocessor, and perhaps
>     going through and scrubbing the a5 references from the assembly
>     might be feasable.

You might be able to do this mostly automatic - something like
sed -e 's_\([a-zA-Z0-9]*\)(a5)_\1_' <oldfile >newfile

(or at least similar - not tested, my sed scripts tend not to work on the
first attempt, so YMMV).

If this is used consistently along all the code, you can't do much wrong
since all occurrences of 'a5' must be changed.

Michael Schwingen, Ahornstrasse 36, 52074 Aachen
New CrossGCC FAQ:
To remove yourself from the crossgcc list, send
mail to with the
text 'unsubscribe' (without the quotes) in the
body of the message.

More information about the crossgcc mailing list