diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2022-05-20 19:21:48 -0700 |
---|---|---|
committer | Sunil K Pandey <skpgkp2@gmail.com> | 2022-07-18 09:06:45 -0700 |
commit | f9f0fbbf7bba29b2f0d916807033faaebe991a33 (patch) | |
tree | 397011e6321277d4ab4e03a5974ddaafea8da333 | |
parent | 650bf51c784e690053907cbd04152820e13338b1 (diff) | |
download | glibc-f9f0fbbf7bba29b2f0d916807033faaebe991a33.tar.gz glibc-f9f0fbbf7bba29b2f0d916807033faaebe991a33.tar.xz glibc-f9f0fbbf7bba29b2f0d916807033faaebe991a33.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)
-rw-r--r-- | sysdeps/x86_64/dl-machine.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 155ca36bd5..4f7b0a546e 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -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 |