about summary refs log tree commit diff
path: root/sysdeps/x86_64/dl-machine.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/x86_64/dl-machine.h')
-rw-r--r--sysdeps/x86_64/dl-machine.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index ca290ef082..2d2ce503a5 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -607,8 +607,9 @@ x86_64_rewrite_plt (struct link_map *map, ElfW(Addr) plt_rewrite)
 	/* Skip ENDBR64 if IBT isn't enabled.  */
 	if (!ibt_enabled_p)
 	  branch_start = ALIGN_DOWN (branch_start, pltent);
-	/* Get the displacement from the branch target.  */
-	ElfW(Addr) disp = value - branch_start - JMP32_INSN_SIZE;
+	/* Get the displacement from the branch target.  NB: We must use
+	   64-bit integer on x32 to avoid overflow.  */
+	uint64_t disp = (uint64_t) value - branch_start - JMP32_INSN_SIZE;
 	ElfW(Addr) plt_end;
 	ElfW(Addr) pad;