This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold] x32: fix relative reloc preference for R_X86_64_32.
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: Pavel Chupin <pavel dot v dot chupin at gmail dot com>, Binutils <binutils at sourceware dot org>
- Date: Tue, 3 Sep 2013 10:39:47 -0700
- Subject: Re: [gold] x32: fix relative reloc preference for R_X86_64_32.
- Authentication-results: sourceware.org; auth=none
- References: <CANwJu19j4QOiCMo+8e8o8QmxmvtC5LRPuPd-POOLR7he_jGJGA at mail dot gmail dot com> <CANwJu19QtiOab_NN+V7AQxoozxHD0c3E5s3hwEM+2JA7-YCC-Q at mail dot gmail dot com> <CAHACq4ozeZsWvFcfmLFWSdr059hCLr=y-vLzTYy0PXw0Apg7Bg at mail dot gmail dot com> <CAHACq4rPejGTJ8Tc=-z4XUkq6YgsuvHmo0g-kjJFoYXi8vsneg at mail dot gmail dot com>
On Tue, Sep 3, 2013 at 10:27 AM, Cary Coutant <ccoutant@google.com> wrote:
>>>> 2013-08-15 Pavel Chupin <pavel.v.chupin@intel.com>
>>>>
>>>> Fix R_X86_64_RELATIVE preference for x32
>>>> * x86_64.cc: Add size check.
>>>>
>>>> OK for mainline?
>>
>> This is OK, thanks. (Sorry for the delay -- I just missed the original.)
>
> Please add PR/15927 to the ChangeLog entry, now that there's a PR for this bug.
>
> -cary
This is what I checked in.
Thanks.
--
H.J.
--
diff --git a/gold/ChangeLog b/gold/ChangeLog
index df61e9c..ed8105d 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
+2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
+
+ PR gold/15927
+ * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
+ relocation for R_X86_64_32 on x32.
+
2013-08-27 Roland McGrath <mcgrathr@google.com>
* output.cc (Output_segment::set_section_addresses): Take new
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index dca6022..5bf78fd 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -2742,7 +2742,8 @@ Target_x86_64<size>::Scan::global(Symbol_table* symtab,
reloc.get_r_offset(),
reloc.get_r_addend());
}
- else if (r_type == elfcpp::R_X86_64_64
+ else if (((size == 64 && r_type == elfcpp::R_X86_64_64)
+ || (size == 32 && r_type == elfcpp::R_X86_64_32))
&& gsym->can_use_relative_reloc(false))
{
Reloc_section* rela_dyn = target->rela_dyn_section(layout);