This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: DT_TEXTREL/.dynamic issue with the binutils 2.15 linker on ARM and Linux


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.


Attachment: binutils-2.15-elf32-arm-textrel.patch
Description: Binary data



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]