diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-04-21 05:20:11 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-04-21 05:20:23 -0700 |
commit | 1f7f2abbc31ee9e6d4faca58bef14d8ee8cb1bd2 (patch) | |
tree | 44da9a8479c288ed3df24c23fb2a1ce24f57fd7a /bfd/elf64-alpha.c | |
parent | e04f33c09f85b936d544c78b1fa6b1134dfbcecd (diff) | |
download | gdb-1f7f2abbc31ee9e6d4faca58bef14d8ee8cb1bd2.zip gdb-1f7f2abbc31ee9e6d4faca58bef14d8ee8cb1bd2.tar.gz gdb-1f7f2abbc31ee9e6d4faca58bef14d8ee8cb1bd2.tar.bz2 |
alpha: Warn DT_TEXTREL with -M
This fixes:
FAIL: DT_TEXTREL map file warning
* elf64-alpha.c (alpha_elf_reloc_entry): Replace reltext with
sec.
(elf64_alpha_check_relocs): Set sec instead of reltext. Warn
DT_TEXTREL with -M.
(elf64_alpha_calc_dynrel_sizes): Warn DT_TEXTREL with -M.
Diffstat (limited to 'bfd/elf64-alpha.c')
-rw-r--r-- | bfd/elf64-alpha.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index ca15944..9f79d8e 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -144,14 +144,14 @@ struct alpha_elf_reloc_entry /* Which .reloc section? */ asection *srel; - /* What kind of relocation? */ - unsigned int rtype; - - /* Is this against read-only section? */ - unsigned int reltext : 1; + /* Which section this relocation is against? */ + asection *sec; /* How many did we find? */ unsigned long count; + + /* What kind of relocation? */ + unsigned int rtype; }; struct alpha_elf_link_hash_entry @@ -1998,9 +1998,9 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info, return FALSE; rent->srel = sreloc; + rent->sec = sec; rent->rtype = r_type; rent->count = 1; - rent->reltext = (sec->flags & SEC_READONLY) != 0; rent->next = h->reloc_entries; h->reloc_entries = rent; @@ -2014,7 +2014,13 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info, loaded into memory, we need a RELATIVE reloc. */ sreloc->size += sizeof (Elf64_External_Rela); if (sec->flags & SEC_READONLY) - info->flags |= DF_TEXTREL; + { + info->flags |= DF_TEXTREL; + info->callbacks->minfo + (_("%pB: dynamic relocation against `%pT' in " + "read-only section `%pA'\n"), + sec->owner, h->root.root.root.string, sec); + } } } } @@ -2699,10 +2705,17 @@ elf64_alpha_calc_dynrel_sizes (struct alpha_elf_link_hash_entry *h, bfd_link_pie (info)); if (entries) { + asection *sec = relent->sec; relent->srel->size += entries * sizeof (Elf64_External_Rela) * relent->count; - if (relent->reltext) - info->flags |= DT_TEXTREL; + if ((sec->flags & SEC_READONLY) != 0) + { + info->flags |= DT_TEXTREL; + info->callbacks->minfo + (_("%pB: dynamic relocation against `%pT' in " + "read-only section `%pA'\n"), + sec->owner, h->root.root.root.string, sec); + } } } |