This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: gold: Treat R_X86_64_GOTPLT64 like R_X86_64_GOT64


On Thu, Nov 13, 2014 at 11:30 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Nov 13, 2014 at 11:13 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>> Hi,
>>
>> R_X86_64_GOTPLT64 isn't necessary and R_X86_64_GOT64 should be used
>> instead.  I checked in this patch to add assembler support for @gotplt,
>> but treat R_X86_64_GOTPLT64 the same R_X86_64_GOT64.  There should be
>> no impact on GCC since GCC never generates R_X86_64_GOTPLT64 and
>> R_X86_64_GOT64 is optimal anyway.
>>
>>
>> H.J.
>> ---
>> bfd/
>>
>>         PR gas/17598
>>         * elf64-x86-64.c (elf_x86_64_check_relocs): Treat
>>         R_X86_64_GOTPLT64 the same as R_X86_64_GOT64.
>>         (elf_x86_64_relocate_section): Likewise.
>>
>> gas/
>>
>>         PR gas/17598
>>         * config/tc-i386.c (reloc): Support BFD_RELOC_X86_64_GOTPLT64.
>>
>> gas/testsuite/
>>
>>         PR gas/17598
>>         * gas/i386/reloc64.s: Add @gotplt check.
>>
>>         * gas/i386/reloc64.d: Updated.
>>         * gas/i386/reloc64.l: Likewise.
>>
>> ld/testsuite/
>>
>>         PR gas/17598
>>         * ld-x86-64/x86-64.exp: Run gotplt1.
>>
>>         * ld-x86-64/gotplt1.d: New file.
>>         * ld-x86-64/gotplt1.s: Likewise.
>
> I checked in this patch to mark R_X86_64_GOTPLT64 obsolete.
>
>
> --
> H.J.
> --
> diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
> index 001a940..aaee35d 100644
> --- a/include/elf/ChangeLog
> +++ b/include/elf/ChangeLog
> @@ -1,3 +1,7 @@
> +2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
> +
> + * x86-64.h (R_X86_64_GOTPLT64): Mark it obsolete.
> +
>  2014-10-17  Jose E. Marchesi  <jose.marchesi@oracle.com>
>
>   * sparc.h (ELF_SPARC_HWCAP2_VIS3B): Documentation improved.
> diff --git a/include/elf/x86-64.h b/include/elf/x86-64.h
> index d0dda47..13f87b2 100644
> --- a/include/elf/x86-64.h
> +++ b/include/elf/x86-64.h
> @@ -58,8 +58,7 @@ START_RELOC_NUMBERS (elf_x86_64_reloc_type)
>       offset to GOT entry */
>       RELOC_NUMBER (R_X86_64_GOTPC64,  29)     /* 64 bit signed pc relative
>       offset to GOT */
> -     RELOC_NUMBER (R_X86_64_GOTPLT64, 30)     /* like GOT64, but indicates
> -     that PLT entry is needed */
> +     RELOC_NUMBER (R_X86_64_GOTPLT64, 30)     /* Obsolete. The same
> as GOT64. */
>       RELOC_NUMBER (R_X86_64_PLTOFF64, 31)     /* 64 bit GOT relative offset
>       to PLT entry */
>       RELOC_NUMBER (R_X86_64_SIZE32,   32)     /* 32-bit symbol size */

Hi Cary,

Here is the corresponding gold patch.  OK for trunk?

Thanks.


-- 
H.J.
----
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 5c719fc..ec76ab9 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,10 @@
+2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+ * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
+ entry for R_X86_64_GOTPLT64.
+ (Target_x86_64<size>::Relocate::relocate): Update comments for
+ R_X86_64_GOTPLT64.
+
 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>

  * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index f58c843..1fb601d 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -2923,11 +2923,6 @@ Target_x86_64<size>::Scan::global(Symbol_table* symtab,
   }
       }
   }
- // For GOTPLT64, we also need a PLT entry (but only if the
- // symbol is not fully resolved).
- if (r_type == elfcpp::R_X86_64_GOTPLT64
-    && !gsym->final_value_is_known())
-  target->make_plt_entry(symtab, layout, gsym);
       }
       break;

@@ -3454,9 +3449,9 @@ Target_x86_64<size>::Relocate::relocate(
       break;

     case elfcpp::R_X86_64_GOT64:
-      // The ABI doc says "Like GOT64, but indicates a PLT entry is needed."
-      // Since we always add a PLT entry, this is equivalent.
     case elfcpp::R_X86_64_GOTPLT64:
+      // R_X86_64_GOTPLT64 is obsolete and treated the the same as
+      // GOT64.
       gold_assert(have_got_offset);
       Relocate_functions<size, false>::rela64(view, got_offset, addend);
       break;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]