This is the mail archive of the binutils@sourceware.org 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: AArch64's Setting DT_TEXTREL Is too Strict.



On 13/08/15 10:01, lin zuojian wrote:
Hi,
     I find that on aarch64, DT_TEXTREL is set in dynamic section when my
     object just has read-only section relocation. On
     aarch64-linux-android, this will cause the following error:
     text relocations (DT_TEXTREL) found in 64-bit ELF file...
     And the shared objects will fail to load.

Android use bionic dynamic linker which has different implemention, it
may be lack of full support of ELF specification. Looks like they forbid
64bit elf to have DT_TEXTREL, I am not sure whether this is caused by
Android is originally designed for 32bit processor, 64bit Android is running
within two years? some corner cases in 64bit bionic may have not be completed.

     Here is the code causes trouble.
/* Find any dynamic relocs that apply to read-only sections.  */

static bfd_boolean
aarch64_readonly_dynrelocs (struct elf_link_hash_entry * h, void * inf)
{
   struct elf_aarch64_link_hash_entry * eh;
   struct elf_dyn_relocs * p;

   eh = (struct elf_aarch64_link_hash_entry *) h;
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
       asection *s = p->sec;

       if (s != NULL && (s->flags & SEC_READONLY) != 0)
	{
	  struct bfd_link_info *info = (struct bfd_link_info *) inf;

	  info->flags |= DF_TEXTREL;

	  /* Not an error, just cut short the traversal.  */
	  return FALSE;
	}
     }
   return TRUE;
}

     Would it be better to change this to .text section only?
     Thank you for reading.
---
Lin Zuojian



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