public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ELF executable relinking
@ 2005-04-13 15:50 Francesco Casadei
  2005-04-13 16:04 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Francesco Casadei @ 2005-04-13 15:50 UTC (permalink / raw)
  To: binutils

Hi all,
I have a simple question I couldn't answer searching the archives or
googling the
web or groups, so here I am.

Basically, I want to add new unrelated code to an existing ELF executable
ET_EXEC), by relinking it with a relocatable object (ET_REL).
Is it possible to input an executable and one or more relocatable
object to the link
editor and generate a new executable with code and data from all objects?

I tried it but it didn't work, I get 'multiple definition errors'
(related to symbols which
marks the .dynamic and .got sections). I also tried preserving the relocation
information within the executable, stripping the duplicate symbols,
link with/without
libc (already linked to the old executable). Nothing seems to work.
The best result I got is a "successfull" relink and segmentation fault.

Please CC me as I'm not subscribed to the list. Thank you.

Regards,
Francesco Casadei

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

* Re: ELF executable relinking
  2005-04-13 15:50 ELF executable relinking Francesco Casadei
@ 2005-04-13 16:04 ` Daniel Jacobowitz
  2005-04-13 16:23   ` Dave Korn
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2005-04-13 16:04 UTC (permalink / raw)
  To: Francesco Casadei; +Cc: binutils

On Wed, Apr 13, 2005 at 11:50:33AM -0400, Francesco Casadei wrote:
> Basically, I want to add new unrelated code to an existing ELF executable
> ET_EXEC), by relinking it with a relocatable object (ET_REL).
> Is it possible to input an executable and one or more relocatable
> object to the link
> editor and generate a new executable with code and data from all objects?

Generally no.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

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

* RE: ELF executable relinking
  2005-04-13 16:04 ` Daniel Jacobowitz
@ 2005-04-13 16:23   ` Dave Korn
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Korn @ 2005-04-13 16:23 UTC (permalink / raw)
  To: 'Daniel Jacobowitz', 'Francesco Casadei'; +Cc: binutils

----Original Message----
>From: Daniel Jacobowitz
>Sent: 13 April 2005 17:03

> On Wed, Apr 13, 2005 at 11:50:33AM -0400, Francesco Casadei wrote:
>> Basically, I want to add new unrelated code to an existing ELF executable
>> ET_EXEC), by relinking it with a relocatable object (ET_REL).
>> Is it possible to input an executable and one or more relocatable
>> object to the link
>> editor and generate a new executable with code and data from all objects?
> 
> Generally no.


  That's why the non-relocatable link is also called a "final" link: it
tends to be fairly final!  (It discards information that would be needed to
link further object files in).


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

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

end of thread, other threads:[~2005-04-13 16:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-13 15:50 ELF executable relinking Francesco Casadei
2005-04-13 16:04 ` Daniel Jacobowitz
2005-04-13 16:23   ` Dave Korn

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