This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
ld -R/--just-symbols broken in 2.11 and 2.12 ?
- From: David McCullough <davidm at snapgear dot com>
- To: binutils at sources dot redhat dot com
- Date: Mon, 13 May 2002 15:59:48 +1000
- Subject: ld -R/--just-symbols broken in 2.11 and 2.12 ?
Hi all,
I have been happily using ld's -R option under binutils-2.10 but cannot get
it to work under 2.11 or 2.12. I have tried it on x86 and SH platforms.
This option basically allows you to link against another programs symbols
without pulling in any of the program.
Great for sharing code in an embedded environment :-)
I am struggling to decide on the best solution for the problem, thus this
email. I figure someone who knows more about ld/bfd interaction may be
able to point me in the right direction :-)
>From what I can see, extra checking has been added to "elf_link_input_bfd"
in the later versions. The comment on the new code reads:
/* Run through the relocs looking for any against symbols
from discarded sections and section symbols from
removed link-once sections. Complain about relocs
against discarded sections. Zero relocs against removed
...
/* Complain if the definition comes from a
discarded section. */
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& elf_discarded_section (h->root.u.def.section)) {
...
They way ld implements '-R' appears to be by adding the symbols to a
discarded section, but with newer versions these symbols are now tagged
as undefined due to the above checks.
If I trace a symbol with '-y symbolname' I see the reference and the
definition appear in the appropriate places and I have added trace to
elf_link_input_bfd to confirm this is where we tag the symbol reference
as undefined.
I figure these checks were added for good reason, so I need a way to
distinguish a discarded section from a "--just-symbols" link against a
file. I thought a section flag would work, but I don't see any space
left there ;-), perhaps an alternative to bfd_abs_section_ptr for this
case ?
Any ideas appreciated as I would truly like to get this functionality back
ASAP ;-)
Thanks,
Davidm
--
David McCullough: Ph: +61 7 3435 2815 http://www.SnapGear.com
davidm@snapgear.com Fx: +61 7 3891 3630 825 Stanley St., W'gabba QLD 4102, Oz