aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2011-01-15 15:49:48 +0000
committerH.J. Lu <hjl.tools@gmail.com>2011-01-15 15:49:48 +0000
commitd1534d1688372ff30dce2c9ff00afe6582f7cc3c (patch)
tree31198b92e74d4428d8af66ddbf7774d9fda728af
parent7f56bc95d624e45cf2ff893d1b1fb4b44c49996f (diff)
downloadgdb-d1534d1688372ff30dce2c9ff00afe6582f7cc3c.zip
gdb-d1534d1688372ff30dce2c9ff00afe6582f7cc3c.tar.gz
gdb-d1534d1688372ff30dce2c9ff00afe6582f7cc3c.tar.bz2
Check invalid x32 relocations.
2011-01-15 H.J. Lu <hongjiu.lu@intel.com> * elf64-x86-64.c (elf_x86_64_check_relocs): Check invalid x32 relocations.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf64-x86-64.c33
2 files changed, 38 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 37c49a3..00ff8ff 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (elf_x86_64_check_relocs): Check invalid x32
+ relocations.
+
2011-01-14 H.J. Lu <hongjiu.lu@intel.com>
* elf64-x86-64.c (elf_x86_64_link_hash_table): Add pointer_r_type.
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 579f59c..9a3959a 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1179,6 +1179,39 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
h = (struct elf_link_hash_entry *) h->root.u.i.link;
}
+ /* Check invalid x32 relocations. */
+ if (!ABI_64_P (abfd))
+ switch (r_type)
+ {
+ default:
+ break;
+
+ case R_X86_64_64:
+ case R_X86_64_DTPOFF64:
+ case R_X86_64_TPOFF64:
+ case R_X86_64_PC64:
+ case R_X86_64_GOTOFF64:
+ case R_X86_64_GOT64:
+ case R_X86_64_GOTPCREL64:
+ case R_X86_64_GOTPC64:
+ case R_X86_64_GOTPLT64:
+ case R_X86_64_PLTOFF64:
+ {
+ if (h)
+ name = h->root.root.string;
+ else
+ name = bfd_elf_sym_name (abfd, symtab_hdr, isym,
+ NULL);
+ (*_bfd_error_handler)
+ (_("%B: relocation %s against symbol `%s' isn't "
+ "supported in x32 mode"), abfd,
+ x86_64_elf_howto_table[r_type].name, name);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ break;
+ }
+
if (h != NULL)
{
/* Create the ifunc sections for static executables. If we