diff options
author | Alan Modra <amodra@gmail.com> | 2011-10-25 03:12:18 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2011-10-25 03:12:18 +0000 |
commit | 4332f25d64da5fccdae956d210c63db3b3129ac9 (patch) | |
tree | 5baa8979dacc24ee738064f64bb9e1a3a8a58174 | |
parent | f1c293297223b8dab3a1fa47679451c1c2552335 (diff) | |
download | gdb-4332f25d64da5fccdae956d210c63db3b3129ac9.zip gdb-4332f25d64da5fccdae956d210c63db3b3129ac9.tar.gz gdb-4332f25d64da5fccdae956d210c63db3b3129ac9.tar.bz2 |
PR ld/13254
include/
2011-10-19 Alan Modra <amodra@gmail.com>
* bfdlink.h (struct bfd_link_info): Add error_textrel.
bfd/
2011-10-19 Alan Modra <amodra@gmail.com>
* elflink.c (bfd_elf_final_link): Emit error_textrel error.
ld/
2011-10-19 Alan Modra <amodra@gmail.com>
* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add
-z text, -z notext, -z textoff options for all targets having
shared lib support.
-rw-r--r-- | bfd/ChangeLog | 4 | ||||
-rw-r--r-- | bfd/elflink.c | 11 | ||||
-rw-r--r-- | include/ChangeLog | 4 | ||||
-rw-r--r-- | include/bfdlink.h | 3 | ||||
-rw-r--r-- | ld/ChangeLog | 6 | ||||
-rw-r--r-- | ld/emultempl/elf32.em | 6 |
6 files changed, 31 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 20793ed..9513fb7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,6 +1,10 @@ 2011-10-25 Alan Modra <amodra@gmail.com> Apply mainline patches + 2011-10-19 Alan Modra <amodra@gmail.com> + PR ld/13254 + * elflink.c (bfd_elf_final_link): Emit error_textrel error. + 2011-10-17 Alan Modra <amodra@gmail.com> PR ld/12975 PR ld/13195 diff --git a/bfd/elflink.c b/bfd/elflink.c index f8741e4..be0a6ce 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; } } diff --git a/include/ChangeLog b/include/ChangeLog index d1349d6..af96977 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,6 +1,10 @@ 2011-10-25 Alan Modra <amodra@gmail.com> Apply mainline patches. + 2011-10-19 Alan Modra <amodra@gmail.com> + PR ld/13254 + * bfdlink.h (struct bfd_link_info): Add error_textrel. + 2011-09-26 Cary Coutant <ccoutant@google.com> gcc PR lto/47247 * plugin-api.h (enum ld_plugin_symbol_resolution): Add diff --git a/include/bfdlink.h b/include/bfdlink.h index c9e127c..be85329 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -337,6 +337,9 @@ struct bfd_link_info /* 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; diff --git a/ld/ChangeLog b/ld/ChangeLog index 8a49cf6..3c1802d 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,6 +1,12 @@ 2011-10-25 Alan Modra <amodra@gmail.com> Apply mainline patches + 2011-10-19 Alan Modra <amodra@gmail.com> + 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. + 2011-10-15 Alan Modra <amodra@gmail.com> * emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Remove toc check. diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 7c8e55b..78a708b 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -2327,6 +2327,12 @@ fragment <<EOF 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 |