This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
AArch64's Setting DT_TEXTREL Is too Strict.
- From: lin zuojian <manjian2006 at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 13 Aug 2015 17:01:16 +0800
- Subject: AArch64's Setting DT_TEXTREL Is too Strict.
- Authentication-results: sourceware.org; auth=none
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