Don't add DT_DEBUG to MIPS shared libraries
Richard Sandiford
richard@codesourcery.com
Thu Apr 12 15:55:00 GMT 2007
Sergey Rogozhkin <rogozhkin@niisi.msk.ru> writes:
>> best to just be consistent with other targets. This patch therefore
>> removes DT_DEBUG tags from shared libraries and makes sure that the
>> PIEs do indeed get DT_DEBUG and DT_MIPS_RLD_MAP tags.
>
> It seems this patch broke PIE startup on linux-mips. bfd/elfxx-mips.c
> code creates DT_MIPS_RLD_MAP entry for pie but doesn't set its value
> (leave it equal to 0). On pie startup, dynamic linker tries to save
> debug structure address to the place pointed by DT_MIPS_RLD_MAP tag
> value. So now it doesn't work even if pie load address is equal to its
> link address. Maybe I miss something or my configuration is wrong?
> I use glibc-2.3.6 and binutils-2.17.50.0.12.
Sorry for the breakage, and for the long time it has taken me to reply.
All the other .rld_map code is indeed guarded with !info->shared rather
than info->executable, and I don't really have time to look at whether
that should change or not. I don't use PIEs myself, but it sounds
like you do, and that they worked OK before the patch. I'd therefore
like to restore the original !info->shared check for the RTLD_MAP code
while keeping the new info->executable check for the DT_DEBUG code.
Tested on mips64-linux-gnu. OK to install?
Richard
bfd/
* elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Don't add
DT_MIPS_RTLD_MAP for PIEs.
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.198
diff -u -p -r1.198 elfxx-mips.c
--- bfd/elfxx-mips.c 26 Mar 2007 10:29:35 -0000 1.198
+++ bfd/elfxx-mips.c 12 Apr 2007 15:32:50 -0000
@@ -7575,18 +7575,16 @@ _bfd_mips_elf_size_dynamic_sections (bfd
must add the entries now so that we get the correct size for
the .dynamic section. The DT_DEBUG entry is filled in by the
dynamic linker and used by the debugger. */
- if (info->executable)
- {
- /* SGI object has the equivalence of DT_DEBUG in the
- DT_MIPS_RLD_MAP entry. */
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
- return FALSE;
- if (!SGI_COMPAT (output_bfd))
- {
- if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
- return FALSE;
- }
- }
+ if (info->executable
+ && !SGI_COMPAT (output_bfd)
+ && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
+ return FALSE;
+
+ /* SGI object has the equivalence of DT_DEBUG in the
+ DT_MIPS_RLD_MAP entry. */
+ if (!info->shared
+ && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
+ return FALSE;
if (reltext && (SGI_COMPAT (output_bfd) || htab->is_vxworks))
info->flags |= DF_TEXTREL;
More information about the Binutils
mailing list