public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Gregory Shtrasberg <shtras@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: R_386_RELATIVE question
Date: Thu, 27 Jan 2011 23:26:00 -0000	[thread overview]
Message-ID: <mcroc72ndkn.fsf@google.com> (raw)
In-Reply-To: <30782193.post@talk.nabble.com> (Gregory Shtrasberg's message of	"Thu, 27 Jan 2011 14:22:14 -0800 (PST)")

Gregory Shtrasberg <shtras@gmail.com> writes:

> What I ment to say is if I want to reassemble the code in some way, the
> address of __dso_handle will change. Naturally, every other place that has
> address in the data section has a linker relocation on it, like R_386_32,
> which also tells me that the value is an address and needs to be altered. So
> that I can change the value according to new code order, e.g. 08 1c 00 00
> will become the new address of __dso_handle.
> But here the only relocation here unlike other places is R_386_RELATIVE,
> which, as you said does different thing.
> So, this looks to me as some sort of bug in gcc. Or am I missing something?

You are looking at a shared library, created using gcc -shared.  I can
tell because only shared libraries have R_386_RELATIVE relocations.  I'm
not sure what you mean by "reassemble", but it is certainly true that
you can not add new code to an existing shared library, any more than
you can add new code to an existing fully linked executable.  A shared
library essentially is an executable, just one that happens to be
position independent.

Let me know if that does not make sense.

Ian

  reply	other threads:[~2011-01-27 23:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27  9:51 Gregory Shtrasberg
2011-01-27 21:40 ` Ian Lance Taylor
2011-01-27 23:00   ` Gregory Shtrasberg
2011-01-27 23:26     ` Ian Lance Taylor [this message]
2011-01-28  0:19       ` Gregory Shtrasberg
2011-01-28  7:24         ` Ian Lance Taylor

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=mcroc72ndkn.fsf@google.com \
    --to=iant@google.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=shtras@gmail.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).