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]

Re: PATCH: Invalid R_X86_64_GOTPCREL -> R_X86_64_PC32 conversions with binutils 2.24/2.25?


On Wed, Jun 24, 2015 at 10:24 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Jun 24, 2015 at 4:26 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> I opened:
>>
>> https://sourceware.org/bugzilla/show_bug.cgi?id=18591
>>
>> H.J.
>>
>
> I checked in this patch to fix it.  Please it out.
>
> Thanks.
>
> H.J.
> ---
> When converting "mov foo@GOTPCREL(%rip), %reg" to "lea foo(%rip), %reg"
> with R_X86_64_PC32 relocation, it may overflow if the target section
> is more than 2GB away.  This patch estimates distance between mov
> instruction and the target section.  We convert R_X86_64_GOTPCREL to
> R_X86_64_PC32 only if their distance is less than 2GB.
>
> PR ld/18591
> * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Don't convert
> R_X86_64_GOTPCREL to R_X86_64_PC32 if it will cause relocation
> overflow.

I checked in this patch to silence older GCC warning.

-- 
H.J.
From 9946dcd126d949d54a0413f72bbe131882ae3443 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 24 Jun 2015 14:12:15 -0700
Subject: [PATCH] Silence older GCC warning

	* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Silence older
	GCC warning.
---
 bfd/ChangeLog      | 5 +++++
 bfd/elf64-x86-64.c | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 49303b3..97c1431 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
 2015-06-24  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Silence older
+	GCC warning.
+
+2015-06-24  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* elf32-i386.c (elf_i386_allocate_dynrelocs): Always allocate
 	space for the first .plt entry.
 	(elf_i386_size_dynamic_sections): Always add DT_PLTGOT for .plt
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index fb22602..3022deb 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2972,6 +2972,9 @@ elf_x86_64_convert_mov_to_lea (bfd *abfd, asection *sec,
 	{
 	  Elf_Internal_Sym *isym;
 
+	  /* Silence older GCC warning.  */
+	  h = NULL;
+
 	  isym = bfd_sym_from_r_symndx (&htab->sym_cache,
 					abfd, r_symndx);
 
-- 
1.9.3


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