Commit 1f560c5f authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Andrei Vagin

compel: Get rid of old piegen code

Use new compel.h header with appropriate types.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 66929a66
......@@ -14,14 +14,4 @@ typedef struct {
long value;
} compel_reloc_t;
/*
* FIXME: Backward compat layer for CRIU. Need to
* drop it later, before the release.
*/
#define elf_reloc_t compel_reloc_t
#define PIEGEN_TYPE_INT COMPEL_TYPE_INT
#define PIEGEN_TYPE_LONG COMPEL_TYPE_LONG
#define PIEGEN_TYPE_GOTPCREL COMPEL_TYPE_GOTPCREL
#endif /* UAPI_COMPEL_H__ */
compel.h
\ No newline at end of file
......@@ -222,7 +222,7 @@ int __handle_elf(void *mem, size_t size)
}
pr_out("/* Autogenerated from %s */\n", opts.input_filename);
pr_out("#include \"%s/types.h\"\n", opts.uapi_dir);
pr_out("#include \"%s/compel.h\"\n", opts.uapi_dir);
for (i = 0; i < symtab_hdr->sh_size / symtab_hdr->sh_entsize; i++) {
Elf_Sym *sym = &symbols[i];
......@@ -265,7 +265,7 @@ int __handle_elf(void *mem, size_t size)
}
}
pr_out("static __maybe_unused elf_reloc_t %s[] = {\n", opts.var_name);
pr_out("static __maybe_unused compel_reloc_t %s[] = {\n", opts.var_name);
pr_debug("Relocations\n");
pr_debug("------------\n");
......
......@@ -17,19 +17,19 @@
#include "log.h"
#include "common/compiler.h"
#include "compel/include/uapi/types.h"
#include "compel/include/uapi/compel.h"
#include "common/bug.h"
__maybe_unused void elf_relocs_apply(void *mem, void *vbase, size_t size, elf_reloc_t *elf_relocs, size_t nr_relocs)
__maybe_unused void elf_relocs_apply(void *mem, void *vbase, size_t size, compel_reloc_t *elf_relocs, size_t nr_relocs)
{
size_t i, j;
for (i = 0, j = 0; i < nr_relocs; i++) {
if (elf_relocs[i].type & PIEGEN_TYPE_LONG) {
if (elf_relocs[i].type & COMPEL_TYPE_LONG) {
long *where = mem + elf_relocs[i].offset;
long *p = mem + size;
if (elf_relocs[i].type & PIEGEN_TYPE_GOTPCREL) {
if (elf_relocs[i].type & COMPEL_TYPE_GOTPCREL) {
int *value = (int *)where;
int rel;
......@@ -40,7 +40,7 @@ __maybe_unused void elf_relocs_apply(void *mem, void *vbase, size_t size, elf_re
j++;
} else
*where = elf_relocs[i].value + elf_relocs[i].addend + (unsigned long)vbase;
} else if (elf_relocs[i].type & PIEGEN_TYPE_INT) {
} else if (elf_relocs[i].type & COMPEL_TYPE_INT) {
int *where = (mem + elf_relocs[i].offset);
*where = elf_relocs[i].value + elf_relocs[i].addend + (unsigned long)vbase;
} else
......
#ifndef __PIE_RELOCS_H__
#define __PIE_RELOCS_H__
#include "compel/include/uapi/types.h"
#include "compel/include/uapi/compel.h"
#include "common/compiler.h"
#include "config.h"
......@@ -9,7 +9,7 @@
#ifdef CONFIG_PIEGEN
extern __maybe_unused void elf_relocs_apply(void *mem, void *vbase, size_t size,
elf_reloc_t *elf_relocs, size_t nr_relocs);
compel_reloc_t *elf_relocs, size_t nr_relocs);
#define pie_size(__pie_name) (round_up(sizeof(__pie_name##_blob) + \
__pie_name ## _nr_gotpcrel * sizeof(long), page_size()))
#define ELF_RELOCS_APPLY(__pie_name, __mem, __vbase) \
......
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