aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-08-13 20:50:27 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-08-13 20:50:27 +0000
commit56d4289c6c259fefb1bd1b30fffb207e48e3dcd5 (patch)
tree581c40cc1a61fbe0de106079b1aab431b3f9549a /bfd
parente2054bcbe666ddc7ef69caa497864b49dbd406df (diff)
downloadgdb-56d4289c6c259fefb1bd1b30fffb207e48e3dcd5.zip
gdb-56d4289c6c259fefb1bd1b30fffb207e48e3dcd5.tar.gz
gdb-56d4289c6c259fefb1bd1b30fffb207e48e3dcd5.tar.bz2
Check if .got.plt section is discarded before using it.
bfd/ 2010-08-13 H.J. Lu <hongjiu.lu@intel.com> PR ld/11913 * elf32-i386.c (elf_i386_finish_dynamic_sections): Check if .got.plt section is discarded. * elf64-x86-64.c (elf64_x86_64_finish_dynamic_sections): Likewise. ld/testsuite/ 2010-08-13 H.J. Lu <hongjiu.lu@intel.com> PR ld/11913 * ld-i386/discarded1.d: New. * ld-i386/discarded1.s: Likewise. * ld-i386/discarded1.t: Likewise. * ld-x86-64/discarded1.d: Likewise. * ld-x86-64/discarded1.s: Likewise. * ld-x86-64/discarded1.t: Likewise. * ld-i386/i386.exp: Run discarded1. * ld-x86-64/x86-64.exp: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf32-i386.c7
-rw-r--r--bfd/elf64-x86-64.c7
3 files changed, 21 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e1c543b..5f18054 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2010-08-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/11913
+ * elf32-i386.c (elf_i386_finish_dynamic_sections): Check if
+ .got.plt section is discarded.
+ * elf64-x86-64.c (elf64_x86_64_finish_dynamic_sections): Likewise.
+
2010-08-13 Nathan Sidwell <nathan@codesourcery.com>
* elf32-m69k.c (elf32_m68k_print_private_bfd_data): Detect EMAC_B
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 0ff3147..4ba1ba0 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -4613,6 +4613,13 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
if (htab->elf.sgotplt)
{
+ if (bfd_is_abs_section (htab->elf.sgotplt->output_section))
+ {
+ (*_bfd_error_handler)
+ (_("discarded output section: `%A'"), htab->elf.sgotplt);
+ return FALSE;
+ }
+
/* Fill in the first three entries in the global offset table. */
if (htab->elf.sgotplt->size > 0)
{
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index b0bc5c0..9899fd4 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -4186,6 +4186,13 @@ elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *inf
if (htab->elf.sgotplt)
{
+ if (bfd_is_abs_section (htab->elf.sgotplt->output_section))
+ {
+ (*_bfd_error_handler)
+ (_("discarded output section: `%A'"), htab->elf.sgotplt);
+ return FALSE;
+ }
+
/* Fill in the first three entries in the global offset table. */
if (htab->elf.sgotplt->size > 0)
{