Subject: Re: arm26 compiler fun
To: Ben Harris <>
From: Richard Earnshaw <>
List: tech-toolchain
Date: 05/08/2000 13:17:48
> I built a more-or-less complete arm26 system with a compiler that didn't
> override STRUCTURE_SIZE_BOUNDARY over the weekend, and it managed to boot
> multi-user over NFS this morning without any unfamiliar bugs, so I think
> I shall keep the compiler like that.
> Is there anything else in config/arm/netbsd.h I should get rid of?


Things to consider are:

  /* Since we always use GAS as our assembler we support stabs.  */

If you are using ELF, then it would be better to switch to DWARF debugging.

  /* On the ARM `@' introduces a comment, so we must use something else
     for .type directives.  Most NetBSD platforms use %, but we use #
     because of some legacy assemblers.  */
  #define TYPE_OPERAND_FMT "#%s"

I'd switch this to % as the comment suggests (the FSF version of gcc uses 

  #define FUNCTION_PROFILER(STREAM,LABELNO)                                
    fprintf(STREAM, "\tmov\t%sip, %slr\n", REGISTER_PREFIX, 
    fprintf(STREAM, "\tbl\tmcount\n");                                     

In ELF the default is normally to not prefix user symbols with '_', so 
this would put mcount in user space.  You should look at other targets and 
see what they do.

  /* NetBSD uses the old PCC style aggregate returning conventions. */

  /* Although not normally relevant (since by default, all aggregates
     are returned in memory) compiling some parts of libc requires
     non-APCS style struct returns.  */

Get rid of both of these (backwards compatibility hacks).  There are some 
changes you will have to make to get the softfloat to compile (it makes 
some broken assumptions about structure returning), but it is better to be 
rid of this deviation from the standard compiler.

Finally, you want to override LINK_SPEC (after including the standard 
netbsd.h).  The definition in FSF distribution adds -X, which strips local 
symbols from linked programs (which means that they are 1) smaller; 2) 
easier to debug).  That is, add something like this after 

  #undef LINK_SPEC
  #define LINK_SPEC \
   "-X \
    %{assert*} \
    %{shared:-shared} \
    %{!shared: \
      -dc -dp \
      %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
      %{!static: \
        %{rdynamic:-export-dynamic} \
        %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \