DT_TEXTREL/.dynamic issue with the binutils 2.15 linker on ARM and Linux
David Poole
daveml@mbuf.com
Tue Jun 1 16:59:00 GMT 2004
On May 29, 2004, at 12:06 AM, Alan Modra wrote:
> On Fri, May 28, 2004 at 10:56:09AM -0400, Daniel Jacobowitz wrote:
>> I don't know why DT_TEXTREL isn't there for this case. It should be.
>
> Perhaps because elf32-arm.h doesn't have something like
> readonly_dynrelocs as implemented in other backends.
Looking at elf32-i386.c and elf32-s390.c, I copied the
readonly_dynrelocs() and the call in
elf_(i386|s390)_size_dynamic_sections.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils-2.15-elf32-arm-textrel.patch
Type: application/octet-stream
Size: 2009 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20040601/7fccef10/attachment.obj>
-------------- next part --------------
Solves my DT_TEXTREL problem but needs more testing.
As a related question, in the original elf32-arm.h, the check for
DF_TEXTREL was done outside the if(relocs):
if (relocs)
{
if ( !add_dynamic_entry (DT_REL, 0)
|| !add_dynamic_entry (DT_RELSZ, 0)
|| !add_dynamic_entry (DT_RELENT, sizeof
(Elf32_External_Rel)))
return FALSE;
}
if ((info->flags & DF_TEXTREL) != 0)
{
if (!add_dynamic_entry (DT_TEXTREL, 0))
return FALSE;
info->flags |= DF_TEXTREL;
}
but in elf32-i386.c and elf32-s390.c, the DF_TEXTREL handling is done
inside the if(relocs):
if (relocs)
{
if (!add_dynamic_entry (DT_REL, 0)
|| !add_dynamic_entry (DT_RELSZ, 0)
|| !add_dynamic_entry (DT_RELENT, sizeof
(Elf32_External_Rel)))
return FALSE;
/* If any dynamic relocs apply to a read-only section,
then we need a DT_TEXTREL entry. */
if ((info->flags & DF_TEXTREL) == 0)
elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
(PTR) info);
if ((info->flags & DF_TEXTREL) != 0)
{
if (!add_dynamic_entry (DT_TEXTREL, 0))
return FALSE;
}
}
Is this an issue in elf32-arm.h or a simply small optimization that
causes no trouble otherwise?
--
David Poole <dpoole _at_ mobl.com>
Mobility Electronics, Idaho http://www.mobl.com
960 Broadway Avenue, Suite 300
Boise, ID 83706
More information about the Binutils
mailing list