Commit b53d9069 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Andrei Vagin

compel: Add R_X86_64{,_REX}_GOTPCRELX relocs

Add handeling of R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX.
They are not that old, so I provided ifdef-guards for them.
According to x86-64 ABI specification paper, they should be
generated instead of R_X86_64_GOTPCREL for cases when relaxation
is possible.

At this moment we can handle them the same way like R_X86_64_GOTPCREL.

[0] https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-r249.pdf

Fixes: #397

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Reported-by: 's avatarAdrian Reber <areber@redhat.com>
Signed-off-by: 's avatarDmitry Safonov <dima@arista.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 342019bb
......@@ -5,6 +5,14 @@
#define ELF_X86_64
#ifndef R_X86_64_GOTPCRELX
# define R_X86_64_GOTPCRELX 41
#endif
#ifndef R_X86_64_REX_GOTPCRELX
# define R_X86_64_REX_GOTPCRELX 42
#endif
#define __handle_elf handle_elf_x86_64
#define arch_is_machine_supported(e_machine) (e_machine == EM_X86_64)
......
......@@ -517,6 +517,8 @@ int __handle_elf(void *mem, size_t size)
*/
*((int32_t *)where) = value32 + addend32 - place;
break;
case R_X86_64_GOTPCRELX:
case R_X86_64_REX_GOTPCRELX:
case R_X86_64_GOTPCREL: /* SymbolOffsetInGot + GOT + Addend - Place (4 bytes) */
pr_debug("\t\t\t\tR_X86_64_GOTPCREL at 0x%-4lx val 0x%x\n", place, value32);
pr_out(" { .offset = 0x%-8x, .type = COMPEL_TYPE_LONG | COMPEL_TYPE_GOTPCREL, "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment