From fd885f3a4d85dc33d794ca359ea91f31e3082717 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 11 May 2012 11:10:19 +0000 Subject: [PATCH] Handle R_X86_64_64 properly for x32 elfcpp/ PR gold/14091 * x86_64.h (R_X86_64_RELATIVE64): New. gold/ PR gold/14091 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of R_X86_64_64. --- elfcpp/ChangeLog | 5 +++++ elfcpp/x86_64.h | 1 + gold/ChangeLog | 7 +++++++ gold/x86_64.cc | 4 +++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/elfcpp/ChangeLog b/elfcpp/ChangeLog index 1ec14e8b301..4c25a870eb8 100644 --- a/elfcpp/ChangeLog +++ b/elfcpp/ChangeLog @@ -1,3 +1,8 @@ +2012-05-11 H.J. Lu + + PR gold/14091 + * x86_64.h (R_X86_64_RELATIVE64): New. + 2012-05-01 Cary Coutant * dwarf.h (enum DW_TAG, enum DW_FORM, enum DW_AT, enum DW_ENCODING) diff --git a/elfcpp/x86_64.h b/elfcpp/x86_64.h index ae7d0a8ba5b..a53beac947c 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/ChangeLog b/gold/ChangeLog index 9e28c6273d0..7fffe40fd6b 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,10 @@ +2012-05-10 H.J. Lu + + PR gold/14091 + * x86_64.cc (Target_x86_64::Scan::local): For x32, generate + R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of + R_X86_64_64. + 2012-05-08 Cary Coutant * layout.cc (gdb_sections): Update GDB version, add .debug_addr. diff --git a/gold/x86_64.cc b/gold/x86_64.cc index 1339e6ff6b1..2ac29bf0d45 100644 --- a/gold/x86_64.cc +++ b/gold/x86_64.cc @@ -2299,7 +2299,9 @@ Target_x86_64::Scan::local(Symbol_table* symtab, unsigned int r_sym = elfcpp::elf_r_sym(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); -- 2.30.2