about summary refs log tree commit diff
path: root/sysdeps/x86_64
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-05-20 19:21:48 -0700
committerSunil K Pandey <skpgkp2@gmail.com>2022-07-18 20:45:20 -0700
commitf6bc52f080e4a0195c707c01f54e2eae0ff89010 (patch)
treee259aec32d8e6fb5e45dd95e47679485399fbff6 /sysdeps/x86_64
parent8ab861d295b90177b89288a2bc95c5de5e4e5bc6 (diff)
downloadglibc-f6bc52f080e4a0195c707c01f54e2eae0ff89010.tar.gz
glibc-f6bc52f080e4a0195c707c01f54e2eae0ff89010.tar.xz
glibc-f6bc52f080e4a0195c707c01f54e2eae0ff89010.zip
x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT
According to x86-64 psABI, r_addend should be ignored for R_X86_64_GLOB_DAT
and R_X86_64_JUMP_SLOT.  Since linkers always set their r_addends to 0, we
can ignore their r_addends.

Reviewed-by: Fangrui Song <maskray@google.com>
(cherry picked from commit f8587a61892cbafd98ce599131bf4f103466f084)
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r--sysdeps/x86_64/dl-machine.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index 94296719d4..7426825171 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -347,11 +347,13 @@ and creates an unsatisfiable circular dependency.\n",
 #  endif
 	  /* Set to symbol size plus addend.  */
 	  value = sym->st_size;
+	  *reloc_addr = value + reloc->r_addend;
+	  break;
 # endif
-	  /* Fall through.  */
+
 	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