+
+ PR ld/13254
+ * elflink.c (bfd_elf_final_link): Emit error_textrel error.
+
PR binutils/13301
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;
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;
}
}
+
+ PR ld/13254
+ * bfdlink.h (struct bfd_link_info): Add error_textrel.
+
* timeval-utils.h: New file.
/* TRUE if we should warn when adding a DT_TEXTREL to a shared object. */
unsigned int warn_shared_textrel: 1;
+ /* TRUE if we should error when adding a DT_TEXTREL. */
+ unsigned int error_textrel: 1;
+
/* TRUE if .hash section should be created. */
unsigned int emit_hash: 1;
+
+ PR ld/13254
+ * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add
+ -z text, -z notext, -z textoff options for all targets having
+ shared lib support.
+
* emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Remove toc check.
link_info.relro = TRUE;
else if (strcmp (optarg, "norelro") == 0)
link_info.relro = FALSE;
+ else if (strcmp (optarg, "text") == 0)
+ link_info.error_textrel = TRUE;
+ else if (strcmp (optarg, "notext") == 0)
+ link_info.error_textrel = FALSE;
+ else if (strcmp (optarg, "textoff") == 0)
+ link_info.error_textrel = FALSE;
EOF
fi