This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: PR gold/14091: Gold doesn't handle R_X86_64_64 properly for x32
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Cc: Ian Lance Taylor <iant at google dot com>
- Date: Thu, 10 May 2012 10:36:37 -0700
- Subject: PATCH: PR gold/14091: Gold doesn't handle R_X86_64_64 properly for x32
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi Ian,
For x32, we should generate R_X86_64_RELATIVE64 instead of
R_X86_64_RELATIVE in case of R_X86_64_64. Tested on Linux/x32 and
Linux/x86-64. OK to install?
Thanks.
H.J.
---
elfcpp/
2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
PR gold/14091
* x86_64.h (R_X86_64_RELATIVE64): New.
gold/
2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
PR gold/14091
* x86_64.cc (Target_i386::Scan::local): For x32, generate
R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
R_X86_64_64
diff --git a/elfcpp/x86_64.h b/elfcpp/x86_64.h
index ae7d0a8..a53beac 100644
--- a/elfcpp/x86_64.h
+++ b/elfcpp/x86_64.h
@@ -91,6 +91,7 @@ enum
R_X86_64_TLSDESC_CALL = 35, // Relaxable call through TLS descriptor
R_X86_64_TLSDESC = 36, // 2 by 64-bit TLS descriptor
R_X86_64_IRELATIVE = 37, // Adjust indirectly by program base
+ R_X86_64_RELATIVE64 = 38, // 64-bit adjust by program base
// GNU vtable garbage collection extensions.
R_X86_64_GNU_VTINHERIT = 250,
R_X86_64_GNU_VTENTRY = 251
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index 1339e6f..2ac29bf 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -2299,7 +2299,9 @@ Target_x86_64<size>::Scan::local(Symbol_table* symtab,
unsigned int r_sym = elfcpp::elf_r_sym<size>(reloc.get_r_info());
Reloc_section* rela_dyn = target->rela_dyn_section(layout);
rela_dyn->add_local_relative(object, r_sym,
- elfcpp::R_X86_64_RELATIVE,
+ (size == 32
+ ? elfcpp::R_X86_64_RELATIVE64
+ : elfcpp::R_X86_64_RELATIVE),
output_section, data_shndx,
reloc.get_r_offset(),
reloc.get_r_addend(), is_ifunc);