public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Relocatable executables
@ 2001-08-22 13:14 Uros Prestor
  2001-08-22 13:18 ` H . J . Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Prestor @ 2001-08-22 13:14 UTC (permalink / raw)
  To: binutils; +Cc: uros.prestor

Hello,

I am using gcc/binutils to develop software for an embedded system (MIPS
ELF).  The executable is statically linked at a fixed text address, no
PIC.  At load time I need to relocate the executable at a different
address.  Is there a way to have ld include relocation info in the
executable?

The naive approach of adding the following two lines in the linker
script does not seem to work:

     .rel.text : { *(.rel.text) }
     .rel.data : { *(.rel.rodata) *(.rel.data) }

On the other hand, compiling with PIC and creating a shared library is
too heavy handed.  Is there an easier way to have ld emit enough info in
the ELF file to allow for a load-time relocation?

Thanks in advance,
Uros

P.S.
Please keep me on the cc: list as I am not subscribed to binutils.

--
Uros Prestor
uros.prestor@nexsi.com



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Relocatable executables
  2001-08-22 13:14 Relocatable executables Uros Prestor
@ 2001-08-22 13:18 ` H . J . Lu
  2001-08-22 13:32   ` Uros Prestor
  0 siblings, 1 reply; 3+ messages in thread
From: H . J . Lu @ 2001-08-22 13:18 UTC (permalink / raw)
  To: Uros Prestor; +Cc: binutils

On Wed, Aug 22, 2001 at 01:15:50PM -0700, Uros Prestor wrote:
> Hello,
> 
> I am using gcc/binutils to develop software for an embedded system (MIPS
> ELF).  The executable is statically linked at a fixed text address, no
> PIC.  At load time I need to relocate the executable at a different
> address.  Is there a way to have ld include relocation info in the
> executable?
> 

`-q'
`--emit-relocs'
     Leave relocation sections and contents in fully linked
     exececutables.  Post link analysis and optimization tools may need
     this information in order to perform correct modifications of
     executables.  This results in larger executables.


H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Relocatable executables
  2001-08-22 13:18 ` H . J . Lu
@ 2001-08-22 13:32   ` Uros Prestor
  0 siblings, 0 replies; 3+ messages in thread
From: Uros Prestor @ 2001-08-22 13:32 UTC (permalink / raw)
  To: H . J . Lu; +Cc: binutils, uros.prestor

"H . J . Lu" wrote:

> `-q'
> `--emit-relocs'
>      Leave relocation sections and contents in fully linked
>      exececutables.  Post link analysis and optimization tools may need
>      this information in order to perform correct modifications of
>      executables.  This results in larger executables.

Thanks, H.J.

My version of ld (2.9.1 with BFD 2.9.1) seems to be too ancient to recognize
--emit-relocs.  Can I do the equivalent of --emit-relocs on 2.9.1 via the
linker script, or do I have to upgrade to a newer version of binutils?

Uros

--
Uros Prestor
uros.prestor@nexsi.com



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-08-22 13:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-22 13:14 Relocatable executables Uros Prestor
2001-08-22 13:18 ` H . J . Lu
2001-08-22 13:32   ` Uros Prestor

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).