linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: Simon Vallet <linux-ppc@castalie.org>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: R_PPC_ADDR16_HI relocs in PPC modules ?
Date: Wed, 3 Jan 2007 08:01:51 +1030	[thread overview]
Message-ID: <20070102213151.GA24185@bubble.grove.modra.org> (raw)
In-Reply-To: <20070102172554.7a94cd37@mlejnas.priv.castalie.org>

On Tue, Jan 02, 2007 at 05:25:54PM +0100, Simon Vallet wrote:
> Is there a reason for this ?

I guess no one has needed the reloc before.  gcc tends to use
"li, addis" pairs to load 32-bit constants.  Your code must be using
"lis, ori".

> If there are no reasons, then how about the following patch ?

Looks good to me.

> --- arch/powerpc/kernel/module_32.c.orig	2007-01-02 17:07:21.000000000 +0100
> +++ arch/powerpc/kernel/module_32.c	2007-01-02 17:11:55.000000000 +0100
> @@ -222,6 +222,11 @@ int apply_relocate_add(Elf32_Shdr *sechd
>  			*(uint16_t *)location = value;
>  			break;
>  		
> +		case R_PPC_ADDR16_HI:
> +			/* Higher half of the symbol */
> +			*(uint16_t *)location = (value >> 16);
> +			break;
> +
>  		case R_PPC_ADDR16_HA:
>  			/* Sign-adjusted lower 16 bits: PPC ELF ABI says:
>  			   (((x >> 16) + ((x & 0x8000) ? 1 : 0))) & 0xFFFF.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

  parent reply	other threads:[~2007-01-02 21:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-02 16:25 R_PPC_ADDR16_HI relocs in PPC modules ? Simon Vallet
2007-01-02 17:16 ` Segher Boessenkool
2007-01-02 18:09   ` Simon Vallet
2007-01-02 20:48     ` Segher Boessenkool
2007-01-03  0:47       ` Paul Mackerras
2007-01-03  1:20         ` Segher Boessenkool
2007-01-02 20:41 ` Benjamin Herrenschmidt
2007-01-03  7:01   ` Simon Vallet
2007-01-03  9:58     ` Benjamin Herrenschmidt
2007-01-03 10:32       ` Simon Vallet
2007-01-03 20:36         ` Benjamin Herrenschmidt
2007-01-02 21:31 ` Alan Modra [this message]
2007-01-03  6:49 ` [PATCH] Add support for R_PPC_ADDR16_HI relocations Simon Vallet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070102213151.GA24185@bubble.grove.modra.org \
    --to=amodra@bigpond.net.au \
    --cc=linux-ppc@castalie.org \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).