Don't add DT_DEBUG to MIPS shared libraries

Sergey Rogozhkin rogozhkin@niisi.msk.ru
Fri Apr 13 11:19:00 GMT 2007


Richard Sandiford wrote:
> 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?

Thank you, it works for me now.

There is also another problem with PIE and DT_MIPS_RLD_MAP on mips. Now 
there is no DT_MIPS_RLD_MAP tag in dynamic section of mips PIEs and 
debugger wouldn't operate properly on such executables. But if linker 
add and properly (as possible) initialize DT_MIPS_RLD_MAP tag to PIE, 
next problem arise in dynamic linker. The problem is DT_MIPS_RLD_MAP is 
not an analog of DT_DEBUG, DT_MIPS_RLD_MAP value is calculated by
linker and used by dynamic linker as a legal address of some data inside 
PIE object, but it is not a legal address if PIE load address != PIE 
link address. So, dynamic linker must fix DT_MIPS_RLD_MAP for PIEs by 
adding a base addr of loaded PIE. I don't know if this is an actual 
problem for anybody, but the problem exists.

Sergey Rogozhkin



More information about the Binutils mailing list