[CRIU] [PATCH] compel: Add R_X86_64{,_REX}_GOTPCRELX relocs

Andrei Vagin avagin at virtuozzo.com
Tue Oct 24 01:45:42 MSK 2017


Applied, thanks!
On Tue, Oct 17, 2017 at 10:38:34PM +0100, Dmitry Safonov wrote:
> 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 at openvz.org>
> Reported-by: Adrian Reber <areber at redhat.com>
> Signed-off-by: Dmitry Safonov <dima at arista.com>
> ---
>  compel/arch/x86/src/lib/include/handle-elf.h | 8 ++++++++
>  compel/src/lib/handle-elf.c                  | 2 ++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/compel/arch/x86/src/lib/include/handle-elf.h b/compel/arch/x86/src/lib/include/handle-elf.h
> index 08de8363..e68fe3bc 100644
> --- a/compel/arch/x86/src/lib/include/handle-elf.h
> +++ b/compel/arch/x86/src/lib/include/handle-elf.h
> @@ -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)
>  
> diff --git a/compel/src/lib/handle-elf.c b/compel/src/lib/handle-elf.c
> index bf94d93b..f1cf74ff 100644
> --- a/compel/src/lib/handle-elf.c
> +++ b/compel/src/lib/handle-elf.c
> @@ -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, "
> -- 
> 2.13.6
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list