public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: yunfeng zhang <zyf.zeroos@gmail.com>
Cc: gcc@gcc.gnu.org
Subject: Re: No .got section in ELF
Date: Tue, 24 Nov 2009 10:00:00 -0000	[thread overview]
Message-ID: <4B0BAECB.3090703@redhat.com> (raw)
In-Reply-To: <4df04b840911231758md5a545el2d417b663af1647f@mail.gmail.com>

yunfeng zhang wrote:
> The idea I got is about removing .got section in ELF format totally.
> 
> Before we go, let's see the limitation on the idea
> 1) It must be deployed on aligned segment model, such as Linux, which cs.start
> = ds.start.
> 2) Currently, I only know how to do on x86 ELF.
> 
> Here is a typical sample in PIC model (shared library) when library want to
> access its global data
>     ...
>     // Later code snippet template is used by gcc in almost all shared function
>     // to imitate `mov %ip, %ebx'.
>     call next:
> next:
>     pop %ebx // << A.
>     ...
>     movl new_offset(%ebx), %eax // << B. load global variable foo to eax.
>     ...
>     .global foo // << C.
> OK!, to ld, offsetof(C - A) is const, and to gcc offsetof(B - A) is also
> const, so to aligned segment model, new_offset = offset(C - A) - offset(B - A),
> right?

Surely not, because in a shared library the address of the data varies.  There
are in theory many copies of the library, each one with its r/w data in a different
place.

Andrew.

  reply	other threads:[~2009-11-24 10:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-24  1:58 yunfeng zhang
2009-11-24 10:00 ` Andrew Haley [this message]
2009-11-24 17:10 ` Richard Henderson
2009-11-26  2:24 ` yunfeng zhang
2009-11-26  3:11   ` Richard Henderson
2009-11-26  6:04     ` yunfeng zhang
2009-11-26  7:55       ` Alexandre Oliva
2009-11-27  2:18         ` yunfeng zhang
2009-11-27  4:12           ` Dave Korn
2009-11-27  4:43             ` yunfeng zhang
2009-11-27  4:46               ` Dave Korn
2009-11-27 13:35           ` Alexandre Oliva
2009-11-30 11:10             ` Yunfeng ZHANG
2009-11-27  4:58       ` Jie Zhang
2009-11-27  6:42         ` yunfeng zhang
2009-11-27 14:16           ` Ian Lance Taylor
2009-11-27  4:51 Dmitry Gorbachev

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=4B0BAECB.3090703@redhat.com \
    --to=aph@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=zyf.zeroos@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).