Subject: Re: elf2bb is not sparc64 host compatible (yet)
To: None <port-amiga@netbsd.org>
From: Gunther Nikl <gni@gecko.de>
List: port-amiga
Date: 09/27/2004 11:01:46
On Sat, Sep 25, 2004 at 02:44:06PM +0200, S.P.Zeidler wrote:
> sparc64 is picky about the locations it accepts write to, so three places
> in elf2bb main give bus errors. The attached patch takes care of that.

  I don't think testing for __sparc64__ is a good fix.

> --- elf2bb.c    2004-09-25 14:26:44.000000000 +0200
> +++ elf2bb.c-fixed      2004-09-25 14:21:22.000000000 +0200
> @@ -312,14 +312,36 @@
>                             htobe32(ra->r_addend), value));
>                         switch (ELF32_R_TYPE(htobe32(ra->r_info))) {
>                         case R_68K_32:
> +#ifdef __sparc64__
> +                               *((char *)(base + htobe32(ra->r_offset))) =
> +                                   (char) ((htobe32(value) & 0xff000000) >> 24);
> +                               *((char *)(base + htobe32(ra->r_offset)) + 1) =
> +                                   (char) ((htobe32(value) & 0x00ff0000) >> 16);
> +                               *((char *)(base + htobe32(ra->r_offset)) + 2) =
> +                                   (char) ((htobe32(value) & 0x0000ff00) >> 8);
> +                               *((char *)(base + htobe32(ra->r_offset)) + 3) =
> +                                   (char) ((htobe32(value) & 0x000000ff));
> +#else
>                                 *((u_int32_t *)(base + htobe32(ra->r_offset))) =
>                                     htobe32(value);
> +#endif
>                                 relbuf[r32sz++] = (base - buffer) + htobe32(ra->r_offset);
>                                 break;

  Can you please explain why sparc64 doesn't like the original code? Its not
  obvious for me.

  Gunther