This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: binutils 2.20.1 on irix 6.5.22 _rld_new_interface question
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: "David E. Cross" <crossd at cs dot rpi dot edu>
- Cc: binutils at sourceware dot org
- Date: Sat, 13 Nov 2010 09:37:50 +0000
- Subject: Re: binutils 2.20.1 on irix 6.5.22 _rld_new_interface question
- References: <20101105132702.W59886@monica.cs.rpi.edu>
Hi David,
Thanks for the report. It's good to hear that recent a GNU ld still
works reasonably well on IRIX 6.5. It's many years since I last had
access to an IRIX box and tried this myself. But there were quite
a few problems that needed to fixed around the 2.16 release, and I was
worried that might be true again now.
"David E. Cross" <crossd@cs.rpi.edu> writes:
> Running binutils 2.20.1 on irix 6.5.22 with great success, moreso then
> native Irix ld in fact.
>
> However I have come across one bug that I am scratching my head over how
> to fix.
>
> Irix has no "dladdr" funtion, instead they tell you to call
> _rld_new_interface with certain parameters and it will do the same things.
> The problem is that _rld_new_interface is a special symbol that is within
> the runtime linker and not in any library.
>
> There is some special handling in bfd/elfxx-mips.c for this already, that
> ammounts to basically ignoring the symble. This works fine for the 99% of
> applications that don't acually use the symbol (and allows things to link
> with libc).. However for programs that DO use it, a undef symbol needs to
> be inserted into the symbol table as a placeholder. Like _I THINK_
> is done with __rld_obj_head. I have tried duplicating the part of the
> code that adds __rld_obj_head without success; (modifiying it to set
> BSF_FUNCTION and ST_FUNC).. I am obviously just stabbing in the dark here
> and I hope someone could help me out.. I have some symbol tables listed
> below:
I think __rld_obj_head is a bit different. IIUC, it's defined in crt1.o,
so is present in effectively all executable links. (Please correct me
if I'm wrong on that. Like I say, it's been a long time.)
The add_symbol hack for _rld_new_interface is gross. It looks like
it should only trigger for DSO inputs though. If you have a regular
.o that references _rld_new_interface, it should get processed in the
normal way.
> Symbols from /lib32/libc.so.1:
>
> [Index] Value Size Type Bind Other Shndx Name
>
> [6243] | 0| 0|FUNC |GLOB |DEFAULT |UNDEF |_rld_new_interface
>
>
> dso_dlfcn (when linked with Irix ld)
>
> [46] | 268438512| 0|FUNC |GLOB |DEFAULT |UNDEF |_rld_new_interface
>
> dso_dlfcn.o (when compiled with Irix cc)
>
> [6] | 0| 0|FUNC |GLOB |DEFAULT |UNDEF |_rld_new_interface
>
>
> dso_dlfcn.o (when compiled with gcc)
>
> [11] | 0| 0|OBJT |GLOB |DEFAULT |UNDEF |_rld_new_interface
Could you also show the relocations against _rld_new_interface in
dso_dlfcn.o? Like you say, the OBJT thing is a bit odd...
Richard