public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* partial linking that resolves relocations
@ 2011-05-18  7:50 Yni Mous
  2011-05-18 23:57 ` Ian Lance Taylor
  2011-05-19 17:33 ` John Reiser
  0 siblings, 2 replies; 4+ messages in thread
From: Yni Mous @ 2011-05-18  7:50 UTC (permalink / raw)
  To: binutils

Hi,

I'm not sure I'm using the correct terminology, so I will use a simple example:

Assuming two C files:

$ cat 1.c
void foo();

void lala() {
       foo();
}
$ cat 2.c
void foo(){}

$ gcc -c 1.c
$ gcc -c 2.c

$ objdump -dr 1.o
0000000000000000 <lala>:
  0:   55                      push   %rbp
  1:   48 89 e5             mov    %rsp,%rbp
  4:   b8 00 00 00 00   mov    $0x0,%eax
  9:   e8 00 00 00 00   callq  e <lala+0xe>
                       a: R_X86_64_PC32        foo+0xfffffffffffffffc
  e:   5d                       pop    %rbp
  f:   c3                         retq

Is there a way to combine object files (1.o and 2.o) to produce another
object file (similar to ld -i) with the relocations "resolved"?

In this particular case I would want something like:

00000000004004a4 <foo>:
 ....
0000000000400494 <lala>:
 400494:       55                      push   %rbp
 400495:       48 89 e5             mov    %rsp,%rbp
 400498:       b8 00 00 00 00   mov    $0x0,%eax
 40049d:       e8 02 00 00 00   callq  4004a4 <foo>
 4004a2:       5d                       pop    %rbp
 4004a3:       c3                       retq


I want to use this as a quick fix for two libraries that export the same symbol.

Thanks,

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

end of thread, other threads:[~2011-05-19 17:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-18  7:50 partial linking that resolves relocations Yni Mous
2011-05-18 23:57 ` Ian Lance Taylor
2011-05-19 17:33 ` John Reiser
2011-05-19 17:50   ` John Reiser

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