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]

AArch64's Setting DT_TEXTREL Is too Strict.


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.
    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]