[CRIU] [PATCH 14/19] compel: Get rid of old piegen code
Cyrill Gorcunov
gorcunov at openvz.org
Wed Sep 21 13:54:29 PDT 2016
Use new compel.h header with appropriate types.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
compel/include/uapi/compel.h | 10 ----------
compel/include/uapi/types.h | 1 -
compel/src/lib/handle-elf.c | 4 ++--
criu/pie/pie-relocs.c | 10 +++++-----
criu/pie/pie-relocs.h | 4 ++--
5 files changed, 9 insertions(+), 20 deletions(-)
delete mode 120000 compel/include/uapi/types.h
diff --git a/compel/include/uapi/compel.h b/compel/include/uapi/compel.h
index 67b67c476c63..10507ce3fb22 100644
--- a/compel/include/uapi/compel.h
+++ b/compel/include/uapi/compel.h
@@ -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__ */
diff --git a/compel/include/uapi/types.h b/compel/include/uapi/types.h
deleted file mode 120000
index 28c80ee9f7cf..000000000000
--- a/compel/include/uapi/types.h
+++ /dev/null
@@ -1 +0,0 @@
-compel.h
\ No newline at end of file
diff --git a/compel/src/lib/handle-elf.c b/compel/src/lib/handle-elf.c
index c458a604d2a1..b7e540ed78e0 100644
--- a/compel/src/lib/handle-elf.c
+++ b/compel/src/lib/handle-elf.c
@@ -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");
diff --git a/criu/pie/pie-relocs.c b/criu/pie/pie-relocs.c
index 72665e39621f..3a178ce79437 100644
--- a/criu/pie/pie-relocs.c
+++ b/criu/pie/pie-relocs.c
@@ -15,19 +15,19 @@
#include "asm-generic/int.h"
#include "compiler.h"
-#include "compel/include/uapi/types.h"
+#include "compel/include/uapi/compel.h"
#include "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;
@@ -38,7 +38,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
diff --git a/criu/pie/pie-relocs.h b/criu/pie/pie-relocs.h
index 2873d5b39970..e2141dcdf0e9 100644
--- a/criu/pie/pie-relocs.h
+++ b/criu/pie/pie-relocs.h
@@ -1,7 +1,7 @@
#ifndef __PIE_RELOCS_H__
#define __PIE_RELOCS_H__
-#include "compel/include/uapi/types.h"
+#include "compel/include/uapi/compel.h"
#include "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) \
--
2.7.4
More information about the CRIU
mailing list