diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2013-11-17 10:30:28 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2013-11-18 09:55:09 -0800 |
commit | f49fe902baaeff0cc73e86330ed0468d48203046 (patch) | |
tree | 422f230106e3ea93fee3247c99fa507c4d92344a /gold/x86_64.cc | |
parent | c9fb6e581486573e4eb9b73dd9036cc5e4c3e9f7 (diff) | |
download | gdb-f49fe902baaeff0cc73e86330ed0468d48203046.zip gdb-f49fe902baaeff0cc73e86330ed0468d48203046.tar.gz gdb-f49fe902baaeff0cc73e86330ed0468d48203046.tar.bz2 |
Add R_X86_64_PC32_BND/R_X86_64_PLT32_BND suppor to gold
elfcpp/
* x86_64.h (R_X86_64_PC32_BND): New.
(R_X86_64_PLT32_BND): Likewise.
gold/
* x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
R_X86_64_PC32 and R_X86_64_PLT32, respectively.
(Target_x86_64<size>::Scan::local): Likewise.
(Target_x86_64<size>::Scan::global): Likewise.
(Target_x86_64<size>::Relocate::relocate): Likewise.
(Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
Likewise.
(Target_x86_64<size>::Scan::check_non_pic(): Handle
R_X86_64_PC32_BND.
* testsuite/Makefile.am (check_PROGRAMS): Add
exception_x86_64_bnd_test.
(exception_x86_64_bnd_test_SOURCES): New macro.
(exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
(exception_x86_64_bnd_test_LDFLAGS): Likewise.
(exception_x86_64_bnd_test_LDADD): Likewise.
(exception_x86_64_bnd_1.o): New rule.
(exception_x86_64_bnd_2.o): Likewise.
* testsuite/Makefile.in: Regenerated.
Diffstat (limited to 'gold/x86_64.cc')
-rw-r--r-- | gold/x86_64.cc | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/gold/x86_64.cc b/gold/x86_64.cc index b9f9f17..a0c4fce 100644 --- a/gold/x86_64.cc +++ b/gold/x86_64.cc @@ -2113,12 +2113,14 @@ Target_x86_64<size>::Scan::get_reference_flags(unsigned int r_type) case elfcpp::R_X86_64_PC64: case elfcpp::R_X86_64_PC32: + case elfcpp::R_X86_64_PC32_BND: case elfcpp::R_X86_64_PC16: case elfcpp::R_X86_64_PC8: case elfcpp::R_X86_64_GOTOFF64: return Symbol::RELATIVE_REF; case elfcpp::R_X86_64_PLT32: + case elfcpp::R_X86_64_PLT32_BND: case elfcpp::R_X86_64_PLTOFF64: return Symbol::FUNCTION_CALL | Symbol::RELATIVE_REF; @@ -2200,6 +2202,7 @@ Target_x86_64<size>::Scan::check_non_pic(Relobj* object, unsigned int r_type, // glibc supports these reloc types, but they can overflow. case elfcpp::R_X86_64_PC32: + case elfcpp::R_X86_64_PC32_BND: // A PC relative reference is OK against a local symbol or if // the symbol is defined locally. if (gsym == NULL @@ -2219,12 +2222,28 @@ Target_x86_64<size>::Scan::check_non_pic(Relobj* object, unsigned int r_type, object->error(_("requires dynamic R_X86_64_32 reloc which may " "overflow at runtime; recompile with -fPIC")); else - object->error(_("requires dynamic %s reloc against '%s' which may " - "overflow at runtime; recompile with -fPIC"), - (r_type == elfcpp::R_X86_64_32 - ? "R_X86_64_32" - : "R_X86_64_PC32"), - gsym->name()); + { + const char *r_name; + switch (r_type) + { + case elfcpp::R_X86_64_32: + r_name = "R_X86_64_32"; + break; + case elfcpp::R_X86_64_PC32: + r_name = "R_X86_64_PC32"; + break; + case elfcpp::R_X86_64_PC32_BND: + r_name = "R_X86_64_PC32_BND"; + break; + default: + gold_unreachable(); + break; + } + object->error(_("requires dynamic %s reloc against '%s' " + "which may overflow at runtime; recompile " + "with -fPIC"), + r_name, gsym->name()); + } this->issued_non_pic_error_ = true; return; @@ -2368,11 +2387,13 @@ Target_x86_64<size>::Scan::local(Symbol_table* symtab, case elfcpp::R_X86_64_PC64: case elfcpp::R_X86_64_PC32: + case elfcpp::R_X86_64_PC32_BND: case elfcpp::R_X86_64_PC16: case elfcpp::R_X86_64_PC8: break; case elfcpp::R_X86_64_PLT32: + case elfcpp::R_X86_64_PLT32_BND: // Since we know this is a local symbol, we can handle this as a // PC32 reloc. break; @@ -2765,6 +2786,7 @@ Target_x86_64<size>::Scan::global(Symbol_table* symtab, case elfcpp::R_X86_64_PC64: case elfcpp::R_X86_64_PC32: + case elfcpp::R_X86_64_PC32_BND: case elfcpp::R_X86_64_PC16: case elfcpp::R_X86_64_PC8: { @@ -2869,6 +2891,7 @@ Target_x86_64<size>::Scan::global(Symbol_table* symtab, break; case elfcpp::R_X86_64_PLT32: + case elfcpp::R_X86_64_PLT32_BND: // If the symbol is fully resolved, this is just a PC32 reloc. // Otherwise we need a PLT entry. if (gsym->final_value_is_known()) @@ -3217,6 +3240,8 @@ Target_x86_64<size>::Relocate::relocate( if (this->skip_call_tls_get_addr_) { if ((r_type != elfcpp::R_X86_64_PLT32 + && r_type != elfcpp::R_X86_64_PLT32_BND + && r_type != elfcpp::R_X86_64_PC32_BND && r_type != elfcpp::R_X86_64_PC32) || gsym == NULL || strcmp(gsym->name(), "__tls_get_addr") != 0) @@ -3320,6 +3345,7 @@ Target_x86_64<size>::Relocate::relocate( break; case elfcpp::R_X86_64_PC32: + case elfcpp::R_X86_64_PC32_BND: Relocate_functions<size, false>::pcrela32(view, object, psymval, addend, address); break; @@ -3343,6 +3369,7 @@ Target_x86_64<size>::Relocate::relocate( break; case elfcpp::R_X86_64_PLT32: + case elfcpp::R_X86_64_PLT32_BND: gold_assert(gsym == NULL || gsym->has_plt_offset() || gsym->final_value_is_known() @@ -4151,7 +4178,9 @@ Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc( case elfcpp::R_X86_64_32: case elfcpp::R_X86_64_32S: case elfcpp::R_X86_64_PC32: + case elfcpp::R_X86_64_PC32_BND: case elfcpp::R_X86_64_PLT32: + case elfcpp::R_X86_64_PLT32_BND: case elfcpp::R_X86_64_GOTPC32: case elfcpp::R_X86_64_GOT32: return 4; |