public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Michael Eager <eager@eagercon.com>
To: Santosh <santosh@acmet.com>, binutils@sourceware.org
Subject: Re: Multiple relocation in ELF
Date: Mon, 24 Jul 2006 18:27:00 -0000	[thread overview]
Message-ID: <44C510D3.5020702@eagercon.com> (raw)
In-Reply-To: <20060724140259.GE6872@bubble.grove.modra.org>

Alan Modra wrote:
> On Mon, Jul 24, 2006 at 04:22:41PM +0530, Santosh wrote:
>> ADDIU r2, RELOCATABLE_SYMBOL + RELOCATABLE_SYMBOL 
>>
>> In ELF, we can emit relocation information for only one symbol having
>> its symbol index, offset and relocation value to apply. But when I try
>> to give more than one relocatable symbol, it cannot be represented by
>> ELF format. 
> 
> ELF can support multiple symbols in a relocation expression.  The trick
> is to apply multiple suitably defined relocations to the one location.

Alan --

Can you give an example of how this might be done?  I don't think that
it is possible to apply two relocations to a single location in ELF.

I can think of one way that this might work, but it's problematic:

If the relocations are in REL format, the addend is saved in the
object file.  (If RELA is used, the addend is in the reloc entry.)
In either case, it seems that the result value from the first
relocation will computed and stored in the output, then overwritten
by the computation of the second relocation.  The only way that
these two relocations could be composed is if REL format is used,
and the result of the relocation overwrote the value in the *input*
object file, so that the result value from the first relocation
is used as the addend of the second.

If this is the scheme, I don't think that this behavior is defined
by the ELF spec.

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

  reply	other threads:[~2006-07-24 18:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-24 10:54 Santosh
2006-07-24 14:03 ` Alan Modra
2006-07-24 18:27   ` Michael Eager [this message]
2006-07-24 19:07     ` Ian Lance Taylor
2006-07-25  0:32       ` David Daney
2006-07-25  4:20         ` Ian Lance Taylor
2006-07-25 10:36           ` Dave Korn
2006-07-25 12:05           ` Paul Koning
2006-07-25 13:42             ` Ian Lance Taylor
2006-07-25 14:07           ` Paul Brook
2006-07-25 14:50             ` Ian Lance Taylor
2006-07-24 23:51     ` Alan Modra
2006-07-25 12:31     ` Richard Earnshaw
2006-07-25 12:53       ` Michael Eager
2006-07-26  6:26         ` Santosh
2006-07-26 14:49           ` Ian Lance Taylor
2006-07-27 10:10             ` Santosh

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=44C510D3.5020702@eagercon.com \
    --to=eager@eagercon.com \
    --cc=binutils@sourceware.org \
    --cc=santosh@acmet.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).