aboutsummaryrefslogtreecommitdiff
path: root/gold/x86_64.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2010-12-15 15:35:27 +0000
committerIan Lance Taylor <ian@airs.com>2010-12-15 15:35:27 +0000
commit2fbb4320cae80e68bd80064cac06588f33546e6f (patch)
tree17cf6d5d83738c099a8c945526c1d28250f0d547 /gold/x86_64.cc
parent02ecc8e968f7524f4c41cd7942adff4ff31afe5c (diff)
downloadgdb-2fbb4320cae80e68bd80064cac06588f33546e6f.zip
gdb-2fbb4320cae80e68bd80064cac06588f33546e6f.tar.gz
gdb-2fbb4320cae80e68bd80064cac06588f33546e6f.tar.bz2
PR gold/12324
* x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error for R_X86_64_32 and R_X86_64_PC32. * testsuite/Makefile.am (ver_matching_def.so): Depend on and use ver_matching_def_pic.o. (ver_matching_def_pic.o): New target.
Diffstat (limited to 'gold/x86_64.cc')
-rw-r--r--gold/x86_64.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index 2dd9611..5ba15c4 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -1329,7 +1329,8 @@ Target_x86_64::Scan::check_non_pic(Relobj* object, unsigned int r_type)
{
switch (r_type)
{
- // These are the relocation types supported by glibc for x86_64.
+ // These are the relocation types supported by glibc for x86_64
+ // which should always work.
case elfcpp::R_X86_64_RELATIVE:
case elfcpp::R_X86_64_IRELATIVE:
case elfcpp::R_X86_64_GLOB_DAT:
@@ -1338,9 +1339,18 @@ Target_x86_64::Scan::check_non_pic(Relobj* object, unsigned int r_type)
case elfcpp::R_X86_64_DTPOFF64:
case elfcpp::R_X86_64_TPOFF64:
case elfcpp::R_X86_64_64:
+ case elfcpp::R_X86_64_COPY:
+ return;
+
+ // glibc supports these reloc types, but they can overflow.
case elfcpp::R_X86_64_32:
case elfcpp::R_X86_64_PC32:
- case elfcpp::R_X86_64_COPY:
+ if (this->issued_non_pic_error_)
+ return;
+ gold_assert(parameters->options().output_is_position_independent());
+ object->error(_("requires dynamic reloc which may overflow at runtime; "
+ "recompile with -fPIC"));
+ this->issued_non_pic_error_ = true;
return;
default: