[CRIU] [PATCH] pie: relocs -- Fix compilation on ARM

Cyrill Gorcunov gorcunov at openvz.org
Mon Jun 15 13:16:39 PDT 2015


Otherwise getting

 | parasite-syscall.c: In function ‘parasite_infect_seized’:
 | parasite-syscall.c:1222:5: error: ‘elf_relocs’ undeclared (first use in this function)

Simply wrap the @elf_relocs_apply with macros.

Reported-by: Andrey Vagin <avagin at openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-restore.c       |  4 +---
 parasite-syscall.c |  3 +--
 pie/pie-relocs.h   | 16 ++++++++++++++--
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 977eb04e3e09..21ad798d8930 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -2390,9 +2390,7 @@ static int remap_restorer_blob(void *addr)
 		return -1;
 	}
 
-	elf_relocs_apply(addr, addr, sizeof(restorer_blob),
-			 restorer_relocs, ARRAY_SIZE(restorer_relocs));
-
+	ELF_RELOCS_APPLY_RESTORER(addr, addr);
 	return 0;
 }
 
diff --git a/parasite-syscall.c b/parasite-syscall.c
index 5ba60078adc4..78af13ba5731 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -1218,8 +1218,7 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item,
 	pr_info("Putting parasite blob into %p->%p\n", ctl->local_map, ctl->remote_map);
 	memcpy(ctl->local_map, parasite_blob, sizeof(parasite_blob));
 
-	elf_relocs_apply(ctl->local_map, ctl->remote_map, sizeof(parasite_blob),
-			 parasite_relocs, ARRAY_SIZE(parasite_relocs));
+	ELF_RELOCS_APPLY_PARASITE(ctl->local_map, ctl->remote_map);
 
 	/* Setup the rest of a control block */
 	ctl->parasite_ip	= (unsigned long)parasite_sym(ctl->remote_map, __export_parasite_head_start);
diff --git a/pie/pie-relocs.h b/pie/pie-relocs.h
index 96f2bc9f2044..1caf266d0911 100644
--- a/pie/pie-relocs.h
+++ b/pie/pie-relocs.h
@@ -7,11 +7,23 @@
 #include "config.h"
 
 #if defined(CONFIG_X86_64) || defined(CONFIG_X86_32) || defined(CONFIG_PPC64)
+
+extern __maybe_unused void elf_relocs_apply(void *mem, void *vbase, size_t size,
+					    elf_reloc_t *elf_relocs, size_t nr_relocs);
 #define PIE_SIZE(__blob_name)	(round_up(sizeof(__blob_name) + nr_gotpcrel * sizeof(long), PAGE_SIZE))
-extern __maybe_unused void elf_relocs_apply(void *mem, void *vbase, size_t size, elf_reloc_t *elf_relocs, size_t nr_relocs);
+#define ELF_RELOCS_APPLY_PARASITE(__mem, __vbase)			\
+	elf_relocs_apply(__mem, __vbase, sizeof(parasite_blob),		\
+			 parasite_relocs, ARRAY_SIZE(parasite_relocs))
+#define ELF_RELOCS_APPLY_RESTORER(__mem, __vbase)			\
+	elf_relocs_apply(__mem, __vbase, sizeof(restorer_blob),		\
+			 restorer_relocs, ARRAY_SIZE(restorer_relocs))
+
 #else
+
 #define PIE_SIZE(__blob_name)	(round_up(sizeof(__blob_name), PAGE_SIZE))
-static always_inline void elf_relocs_apply(void *mem, void *vbase, size_t size, elf_reloc_t *elf_relocs, size_t nr_relocs) { }
+#define ELF_RELOCS_APPLY_PARASITE(__mem, __vbase)
+#define ELF_RELOCS_APPLY_RESTORER(__mem, __vbase)
+
 #endif
 
 #endif /* __PIE_RELOCS_H__ */
-- 
2.4.3



More information about the CRIU mailing list