[gold] x32: fix relative reloc preference for R_X86_64_32.

H.J. Lu hjl.tools@gmail.com
Tue Sep 3 17:39:00 GMT 2013


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);



More information about the Binutils mailing list