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 21:40:00 -0000 [thread overview]
Message-ID: <mcrhbcuowna.fsf@google.com> (raw)
In-Reply-To: <30775689.post@talk.nabble.com> (Gregory Shtrasberg's message of "Thu, 27 Jan 2011 01:51:49 -0800 (PST)")
Gregory Shtrasberg <shtras@gmail.com> writes:
> Hello. I've got a question about the purpose of R_386_RELATIVE relocation
> Here's a part of disassemble of a library, built as follows:
> g++ -fPIC -c test.cpp -o test.o
> g++ -shared -Wl,-q -o libtest.so test.o
>
> At 0x1bcc there is a R_386_RELATIVE relocation, and the data in this address
> is 0x1c08, which is an address of __dso_handle. As far as I understand, it's
> not the job of R_386_RELATIVE to fix the value, so there should have been a
> linker relocation on 0x1bcc, pointing to 0x1c08. Am I right? (There is no
> other relocation on 0x1bcc besides R_386_RELATIVE)
> Thanks in advance
>
> Disassembly of section .got:
>
> 00001bcc <.got>:
> 1bcc: 08 1c 00 or %bl,(%eax,%eax,1)
> 1bcc: R_386_RELATIVE *ABS*
The value 0x1c08 is already there, in the section contents (see the
bytes "08 1c" and recall that the i386 is little-endian). The
R_386_RELATIVE directs the dynamic linker to adjust the value by the
load address of the shared library, so that at runtime it will be the
address where __dso_handle winds up.
Ian
next prev parent reply other threads:[~2011-01-27 21:38 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 [this message]
2011-01-27 23:00 ` Gregory Shtrasberg
2011-01-27 23:26 ` Ian Lance Taylor
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=mcrhbcuowna.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).