aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-10-19 04:13:28 +0000
committerAlan Modra <amodra@gmail.com>2011-10-19 04:13:28 +0000
commitc192a1336807cc9515666b1ba5028b6e36d91a3a (patch)
treeb5cbdfa6dd2a03a8293174b24a42b3e1d2dbb5ed /bfd/elflink.c
parentf1a81b376af4c8f09ecb6b11334b87e5badfc340 (diff)
downloadgdb-c192a1336807cc9515666b1ba5028b6e36d91a3a.zip
gdb-c192a1336807cc9515666b1ba5028b6e36d91a3a.tar.gz
gdb-c192a1336807cc9515666b1ba5028b6e36d91a3a.tar.bz2
PR ld/13254
include/ * bfdlink.h (struct bfd_link_info): Add error_textrel. bfd/ * elflink.c (bfd_elf_final_link): Emit error_textrel error. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add -z text, -z notext, -z textoff options for all targets having shared lib support.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 18aefdb..bd1f2f2 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -11187,7 +11187,8 @@ 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 && info->shared)
+ if ((info->warn_shared_textrel && info->shared)
+ || info->error_textrel)
{
bfd_byte *dyncon, *dynconend;
@@ -11205,8 +11206,12 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (dyn.d_tag == DT_TEXTREL)
{
- info->callbacks->einfo
- (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
+ if (info->error_textrel)
+ info->callbacks->einfo
+ (_("%P%X: read-only segment has dynamic relocations.\n"));
+ else
+ info->callbacks->einfo
+ (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
break;
}
}