diff options
author | Alexander Ivchenko <alexander.ivchenko@intel.com> | 2014-05-28 10:50:07 +0400 |
---|---|---|
committer | Alexander Ivchenko <alexander.ivchenko@intel.com> | 2014-05-28 11:04:15 +0400 |
commit | b2a417bdb17191ef2afc20bbd308e308c0730403 (patch) | |
tree | 9582335e7ebd21d308d678ac0fab957b25180113 /binutils-2.24 | |
parent | e0bca373a85fa71b89d9ea42370433b3c0499b9d (diff) | |
download | toolchain_binutils-b2a417bdb17191ef2afc20bbd308e308c0730403.zip toolchain_binutils-b2a417bdb17191ef2afc20bbd308e308c0730403.tar.gz toolchain_binutils-b2a417bdb17191ef2afc20bbd308e308c0730403.tar.bz2 |
[2.23, 2.24] Backport of two patches for Gold that fix the issue with
linking using -fpie and -mcmodel=large. Both patches are already in 2.24
upstream branch.
https://sourceware.org/bugzilla/show_bug.cgi?id=16945
https://sourceware.org/bugzilla/show_bug.cgi?id=16870
commit c23dd3426c75fbf7fa9f30a4082be034818967c1
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue May 27 12:19:33 2014 -0700
Properly handle 64-bit GOT relocations
This patch fixes 2 issues:
1. Since the GOT offset is always negative, we need to use signed int
to support 64-bit GOT relocations.
2. R_X86_64_PLTOFF64 uses the address of GLOBAL_OFFSET_TABLE, which is
the address of the .got.plt section, not the .got section.
commit 7849f6d8dc37fc3da2fec06ac1d47afbe4b81059
Author: Cary Coutant <ccoutant@google.com>
Date: Wed Apr 23 15:17:16 2014 -0700
Add missing break statement for case elfcpp::R_X86_64_PLTOFF64.
gold/
* x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
Change-Id: Icb3cb1de77a7d467fccb715dc6da83c6d2c5c2a6
Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>
Diffstat (limited to 'binutils-2.24')
-rw-r--r-- | binutils-2.24/gold/x86_64.cc | 8 |
1 files changed, 6 insertions, 2 deletions
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); |