diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 8 | ||||
-rw-r--r-- | bfd/elflink.c | 10 | ||||
-rw-r--r-- | bfd/elfxx-x86.c | 6 |
3 files changed, 16 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f165b00..0fe1644 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2020-05-27 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/22909 + * elflink.c (bfd_elf_final_link): Use bfd_link_textrel_check. + Check bfd_link_dll when issue a DT_TEXTREL warning. + * elfxx-x86.c (maybe_set_textrel): Likewise. + (_bfd_x86_elf_size_dynamic_sections): Likewise. + 2020-05-26 Nick Clifton <nickc@redhat.com> * plugin.c (try_load_plugin): Extend error message when a plugin diff --git a/bfd/elflink.c b/bfd/elflink.c index c157aea..f87927f 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -12896,8 +12896,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) goto error_return; /* Check for DT_TEXTREL (late, in case the backend removes it). */ - if (((info->warn_shared_textrel && bfd_link_pic (info)) - || info->error_textrel) + if (bfd_link_textrel_check (info) && (o = bfd_get_linker_section (dynobj, ".dynamic")) != NULL) { bfd_byte *dyncon, *dynconend; @@ -12912,12 +12911,15 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (dyn.d_tag == DT_TEXTREL) { - if (info->error_textrel) + if (info->textrel_check == textrel_check_error) info->callbacks->einfo (_("%P%X: read-only segment has dynamic relocations\n")); + else if (bfd_link_dll (info)) + info->callbacks->einfo + (_("%P: warning: creating DT_TEXTREL in a shared object\n")); else info->callbacks->einfo - (_("%P: warning: creating a DT_TEXTREL in a shared object\n")); + (_("%P: warning: creating DT_TEXTREL in a PIE\n")); break; } } diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index 9679dca..6cc47af 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -575,8 +575,7 @@ maybe_set_textrel (struct elf_link_hash_entry *h, void *inf) "in read-only section `%pA'\n"), sec->owner, h->root.root.string, sec); - if ((info->warn_shared_textrel && bfd_link_pic (info)) - || info->error_textrel) + if (bfd_link_textrel_check (info)) /* xgettext:c-format */ info->callbacks->einfo (_("%P: %pB: warning: relocation against `%s' " "in read-only section `%pA'\n"), @@ -1117,8 +1116,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, && (info->flags & DF_TEXTREL) == 0) { info->flags |= DF_TEXTREL; - if ((info->warn_shared_textrel && bfd_link_pic (info)) - || info->error_textrel) + if (bfd_link_textrel_check (info)) /* xgettext:c-format */ info->callbacks->einfo (_("%P: %pB: warning: relocation " |