This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: Don't add addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT


Hi,

x86-64 psABI specifies that R_X86_64_GLOB_DAT and R_X86_64_JUMP_SLOT
should use the symbol value without addend.  This patch removes addend
from R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT.  It wasn't a problem before
since addend is cleared for R_X86_64_GLOB_DAT and R_X86_64_JUMP_SLOT:

do_glob_dat:
          bfd_put_64 (output_bfd, (bfd_vma) 0,
                      htab->elf.sgot->contents + h->got.offset);
          rela.r_info = htab->r_info (h->dynindx, R_X86_64_GLOB_DAT);
          rela.r_addend = 0; 

        {
          rela.r_info = htab->r_info (h->dynindx, R_X86_64_JUMP_SLOT);
          rela.r_addend = 0;
          plt_index = htab->next_jump_slot_index++;
        }

Tested on x86-64.  OK for 2.18?


H.J.
---
2012-12-19  H.J. Lu  <hongjiu.lu@intel.com>

	[BZ #14978]
	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Don't add
	addend for R_X86_64_GLOB_DAT and R_X86_64_JUMP_SLOT.

diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index d2654aa..0230dcd 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -288,7 +288,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
 	{
 	case R_X86_64_GLOB_DAT:
 	case R_X86_64_JUMP_SLOT:
-	  *reloc_addr = value + reloc->r_addend;
+	  *reloc_addr = value;
 	  break;
 
 # ifndef RESOLVE_CONFLICT_FIND_MAP


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