diff options
-rw-r--r-- | binutils-2.23/gold/x86_64.cc | 8 | ||||
-rw-r--r-- | binutils-2.24/gold/x86_64.cc | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/binutils-2.23/gold/x86_64.cc b/binutils-2.23/gold/x86_64.cc index 2014bc5..4ec7af3 100644 --- a/binutils-2.23/gold/x86_64.cc +++ b/binutils-2.23/gold/x86_64.cc @@ -3252,7 +3252,9 @@ Target_x86_64<size>::Relocate::relocate( // We need to subtract the size of the GOT section to get // the actual offset to use in the relocation. bool have_got_offset = false; - unsigned int got_offset = 0; + // Since the actual offset is always negative, we use signed int to + // support 64-bit GOT relocations. + int got_offset = 0; switch (r_type) { case elfcpp::R_X86_64_GOT32: @@ -3353,10 +3355,12 @@ Target_x86_64<size>::Relocate::relocate( gold_assert(gsym->has_plt_offset() || gsym->final_value_is_known()); typename elfcpp::Elf_types<size>::Elf_Addr got_address; - got_address = target->got_section(NULL, NULL)->address(); + // This is the address of GLOBAL_OFFSET_TABLE. + got_address = target->got_plt_section()->address(); Relocate_functions<size, false>::rela64(view, object, psymval, addend - got_address); } + break; case elfcpp::R_X86_64_GOT32: gold_assert(have_got_offset); diff --git a/binutils-2.24/gold/x86_64.cc b/binutils-2.24/gold/x86_64.cc index a0c4fce..cd3268c 100644 --- a/binutils-2.24/gold/x86_64.cc +++ b/binutils-2.24/gold/x86_64.cc @@ -3286,7 +3286,9 @@ Target_x86_64<size>::Relocate::relocate( // We need to subtract the size of the GOT section to get // the actual offset to use in the relocation. bool have_got_offset = false; - unsigned int got_offset = 0; + // Since the actual offset is always negative, we use signed int to + // support 64-bit GOT relocations. + int got_offset = 0; switch (r_type) { case elfcpp::R_X86_64_GOT32: @@ -3389,10 +3391,12 @@ Target_x86_64<size>::Relocate::relocate( gold_assert(gsym->has_plt_offset() || gsym->final_value_is_known()); typename elfcpp::Elf_types<size>::Elf_Addr got_address; - got_address = target->got_section(NULL, NULL)->address(); + // This is the address of GLOBAL_OFFSET_TABLE. + got_address = target->got_plt_section()->address(); Relocate_functions<size, false>::rela64(view, object, psymval, addend - got_address); } + break; case elfcpp::R_X86_64_GOT32: gold_assert(have_got_offset); |