Subject: Re: ELF
To: Frederick Bruckman <fredb@immanent.net>
From: Bill Studenmund <wrstuden@zembu.com>
List: port-mac68k
Date: 07/16/2001 16:03:05
On Mon, 16 Jul 2001, Frederick Bruckman wrote:

> That's the ticket! I modified the script slightly to specify
> OUTPUT_FORMAT(a.out-m68k-netbsd) and added
> 
>   /DISCARD/     :
>   {
>     *(.ident)
>     *(.note)
>   }
> 
> to the beginning of the SECTIONS.

Cool. That would aleviate the need for the remove options to objcopy.

> I don't actually have an m68k/ELF toolchain on the mac, so I tested
> the idea of building an i386/a.out kernel on 1.5.1/i386. When I go to
> cross-compile an m68k kernel (with the package m68k/ELF 1.3.0
> compiler), I run into more problems...
> 
> Everything mostly compiles with the addition of
> "-Wa,--register-prefix-optional" to ${CFLAGS}, and
> --register-prefix-options to ${NORMAL_S}.
> 
> The compiler doesn't like the bit in mrg_aline_super() about being
> told to preserve "a6". I wonder how it can -- maybe that's just a
> no-op with the old compiler.

Not sure about this.

> Finally, there's the business of ELF adding underscores to symbol
> names, causing many of the assembly defined entry points to give
> "undefined symbol" at linktime (even without the ldscript). How are
> you supposed to deal with that?

I think it's actually ELF _not_ adding underscores. :-)

Usually what we do is, for routines processed by CPP, use the
_C_LABEL() macro (in machine/asm.h). It makes a label which can be
called by C routines. On a.out systems, it prepends an underscore. On ELF
it doesn't.

Take care,

Bill