public inbox for bfd@sourceware.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@zembu.com>
To: hjl@lucon.org
Cc: bfd@cygnus.com
Subject: Re: arm questions
Date: Thu, 15 Apr 1999 13:59:00 -0000	[thread overview]
Message-ID: <19990415205901.3326.qmail@daffy.airs.com> (raw)
In-Reply-To: <m10Xskk-000ErMC@ocean.lucon.org>

   From: hjl@lucon.org (H.J. Lu)
   Date: Thu, 15 Apr 1999 13:28:50 -0700 (PDT)

   Ok. You are saying RELA is better than REL. Does it make any senses
   to use RELA for relocatable object and allow REL for excutable and
   shared objects?

It is possible in principle.

In the general case, it is hard.  ELF permits a shared library to be
compiled normally, not PIC.  In such a case, you have to use arbitrary
relocations in the shared library.  The dynamic linker then runs into
the same addend problems as the program linker does.

For a PIC shared library, there is normally only a very restricted set
of dynamic relocs: a GOT reloc, a JMP reloc, a RELATIVE reloc, and
perhaps a few relocs in the .data section.  All of these relocs can
normally be easily represented using REL relocs.

Since in principle the dynamic linker can handle both REL and RELA
relocs in the same object, it would be possible in principle to add
this optimization for an ELF target which used RELA relocs.

I think it would probably be more immediately effective to focus
efforts on reducing the total number of dynamic relocations in libc.
For example, it has scads of RELATIVE relocs; why?  It has GLOB_DAT
and JUMP_SLOT relocs for what appear to be internal symbols; it may be
possible to eliminate these.

   >    > In the meantime, Cygnus implemented ARM ELF, using RELA relocs.
   > 
   >    Something of which we were entirely unaware of at the time, otherwise we would
   >    have attempted to collaborate in a closer fashion.
   > 
   > I now recall that I dropped the ball on this one.  I saw the request
   > for the ARM ELF work come in to Cygnus, but I didn't manage to figure
   > out that it was for a different ABI than the one in H.J.'s snapshots.
   > 

   If RELA is really desired, can ARM/Linux switch to RELA with a different
   soname? Binaries using REL should still run ok, just like what we did
   to libc 5 on x86.

If REL works now, there is probably no reason to switch to RELA.  The
only reason I can think of would be if the compiler can gain an
advantage by splitting instructions which require relocations.  It is
sometime possible to make that work with REL instructions anyhow.

It would also be possible for the linker to support REL and RELA
relocations simultaneously, so there would be no need for a big
cutover.  We would just change gas to start generating RELA
relocations, and then after a while we could throw away the REL
support.

But I don't see a reason to do that if the code works now.

Ian

  reply	other threads:[~1999-04-15 13:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-15 10:38 Doug Evans
1999-04-15 11:01 ` Ian Lance Taylor
1999-04-15 11:31   ` Scott Bambrough
1999-04-15 11:47     ` Ian Lance Taylor
1999-04-15 13:29       ` H.J. Lu
1999-04-15 13:59         ` Ian Lance Taylor [this message]
1999-04-15 14:15           ` Mixing REL and RELA H.J. Lu
1999-04-15 14:21             ` Ian Lance Taylor
1999-04-15 14:28               ` H.J. Lu
1999-04-15 13:10   ` arm questions H.J. Lu
1999-04-15 13:45     ` Ian Lance Taylor
1999-04-15 13:36   ` Philip Blundell
1999-04-16  0:43     ` Lee Smith
1999-04-16  3:21       ` Toshi Morita
     [not found]     ` <3.0.5.32.19990416083918.0099b8a0.cygnus.local.bfd@mail1.bateman.arm.com>
1999-04-18 17:10       ` Doug Evans

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=19990415205901.3326.qmail@daffy.airs.com \
    --to=ian@zembu.com \
    --cc=bfd@cygnus.com \
    --cc=hjl@lucon.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 read-only IMAP folder(s) and NNTP newsgroup(s).