]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 21 May 2022 02:21:48 +0000 (19:21 -0700)
committerSunil K Pandey <skpgkp2@gmail.com>
Mon, 18 Jul 2022 16:06:45 +0000 (09:06 -0700)
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)

sysdeps/x86_64/dl-machine.h

index 155ca36bd560796d54b18fe1fc0cb425e6339f0d..4f7b0a546e842f00209be7d7ef93be9628751dfe 100644 (file)
@@ -339,11 +339,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