summary refs log tree commit diff
path: root/sysdeps/x86_64/dl-machine.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-05-20 19:21:48 -0700
committerH.J. Lu <hjl.tools@gmail.com>2022-05-26 14:00:25 -0700
commitf8587a61892cbafd98ce599131bf4f103466f084 (patch)
tree25e2e6d4e2074eafb4184ffa4418de2fc484ae0c /sysdeps/x86_64/dl-machine.h
parent9c66efb86fe384f77435f7e326333fb2e4e10676 (diff)
downloadglibc-f8587a61892cbafd98ce599131bf4f103466f084.tar.gz
glibc-f8587a61892cbafd98ce599131bf4f103466f084.tar.xz
glibc-f8587a61892cbafd98ce599131bf4f103466f084.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>
Diffstat (limited to 'sysdeps/x86_64/dl-machine.h')
-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 c70af7ab1e..7f607f6dff 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -325,11 +325,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;
 
 	case R_X86_64_DTPMOD64: