Blame SOURCES/kexec-tools-2.0.20-makedumpfile-PATCH-Remove-duplicated-variable-definitions.patch

1a067e
From 399f2c9a3acd5bd913e50a4dde52dee6527b297e Mon Sep 17 00:00:00 2001
1a067e
From: Kairui Song <kasong@redhat.com>
1a067e
Date: Wed, 29 Jan 2020 13:37:13 +0800
1a067e
Subject: [PATCH 2/7] [PATCH] Remove duplicated variable definitions
1a067e
1a067e
When building on Fedora 32 (with GCC 10), following error is observed:
1a067e
1a067e
/usr/bin/ld: erase_info.o:/tmp/makedumpfile/makedumpfile.h:2010: multiple definition of
1a067e
 `crash_reserved_mem_nr'; elf_info.o:/tmp/makedumpfile/makedumpfile.h:2010: first defined here
1a067e
/usr/bin/ld: erase_info.o:/tmp/makedumpfile/makedumpfile.h:2009: multiple definition of
1a067e
 `crash_reserved_mem'; elf_info.o:/tmp/makedumpfile/makedumpfile.h:2009: first defined here
1a067e
/usr/bin/ld: erase_info.o:/tmp/makedumpfile/makedumpfile.h:1278: multiple definition of
1a067e
 `parallel_info_t'; elf_info.o:/tmp/makedumpfile/makedumpfile.h:1278: first defined here
1a067e
/usr/bin/ld: erase_info.o:/tmp/makedumpfile/makedumpfile.h:1265: multiple definition of
1a067e
 `splitting_info_t'; elf_info.o:/tmp/makedumpfile/makedumpfile.h:1265: first defined here
1a067e
...
1a067e
collect2: error: ld returned 1 exit status
1a067e
make: *** [Makefile:97: makedumpfile] Error 1
1a067e
1a067e
These variables are wrongly defined multiple times. So remove the
1a067e
duplicated definitions.
1a067e
1a067e
Signed-off-by: Kairui Song <kasong@redhat.com>
1a067e
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
1a067e
---
1a067e
 makedumpfile.c | 8 ++++----
1a067e
 makedumpfile.h | 8 ++++----
1a067e
 2 files changed, 8 insertions(+), 8 deletions(-)
1a067e
1a067e
diff --git a/makedumpfile-1.6.7/makedumpfile.c b/makedumpfile-1.6.7/makedumpfile.c
1a067e
index e290fbd..ae7336a 100644
1a067e
--- a/makedumpfile-1.6.7/makedumpfile.c
1a067e
+++ b/makedumpfile-1.6.7/makedumpfile.c
1a067e
@@ -10954,7 +10954,7 @@ check_param_for_reassembling_dumpfile(int argc, char *argv[])
1a067e
 		return FALSE;
1a067e
 
1a067e
 	if ((info->splitting_info
1a067e
-	    = malloc(sizeof(splitting_info_t) * info->num_dumpfile))
1a067e
+	    = malloc(sizeof(struct splitting_info) * info->num_dumpfile))
1a067e
 	    == NULL) {
1a067e
 		MSG("Can't allocate memory for splitting_info.\n");
1a067e
 		return FALSE;
1a067e
@@ -11042,7 +11042,7 @@ check_param_for_creating_dumpfile(int argc, char *argv[])
1a067e
 			return FALSE;
1a067e
 		}
1a067e
 		if ((info->splitting_info
1a067e
-		    = malloc(sizeof(splitting_info_t) * info->num_dumpfile))
1a067e
+		    = malloc(sizeof(struct splitting_info) * info->num_dumpfile))
1a067e
 		    == NULL) {
1a067e
 			MSG("Can't allocate memory for splitting_info.\n");
1a067e
 			return FALSE;
1a067e
@@ -11077,13 +11077,13 @@ check_param_for_creating_dumpfile(int argc, char *argv[])
1a067e
 
1a067e
 	if (info->num_threads) {
1a067e
 		if ((info->parallel_info =
1a067e
-		     malloc(sizeof(parallel_info_t) * info->num_threads))
1a067e
+		     malloc(sizeof(struct parallel_info) * info->num_threads))
1a067e
 		    == NULL) {
1a067e
 			MSG("Can't allocate memory for parallel_info.\n");
1a067e
 			return FALSE;
1a067e
 		}
1a067e
 
1a067e
-		memset(info->parallel_info, 0, sizeof(parallel_info_t)
1a067e
+		memset(info->parallel_info, 0, sizeof(struct parallel_info)
1a067e
 							* info->num_threads);
1a067e
 	}
1a067e
 
1a067e
diff --git a/makedumpfile-1.6.7/makedumpfile.h b/makedumpfile-1.6.7/makedumpfile.h
1a067e
index 68d9691..7217407 100644
1a067e
--- a/makedumpfile-1.6.7/makedumpfile.h
1a067e
+++ b/makedumpfile-1.6.7/makedumpfile.h
1a067e
@@ -1262,7 +1262,7 @@ struct splitting_info {
1a067e
 	mdf_pfn_t		end_pfn;
1a067e
 	off_t			offset_eraseinfo;
1a067e
 	unsigned long		size_eraseinfo;
1a067e
-} splitting_info_t;
1a067e
+};
1a067e
 
1a067e
 struct parallel_info {
1a067e
 	int			fd_memory;
1a067e
@@ -1275,7 +1275,7 @@ struct parallel_info {
1a067e
 #ifdef USELZO
1a067e
 	lzo_bytep		wrkmem;
1a067e
 #endif
1a067e
-} parallel_info_t;
1a067e
+};
1a067e
 
1a067e
 struct ppc64_vmemmap {
1a067e
 	unsigned long		phys;
1a067e
@@ -2006,8 +2006,8 @@ struct memory_range {
1a067e
 };
1a067e
 
1a067e
 #define CRASH_RESERVED_MEM_NR   8
1a067e
-struct memory_range crash_reserved_mem[CRASH_RESERVED_MEM_NR];
1a067e
-int crash_reserved_mem_nr;
1a067e
+extern struct memory_range crash_reserved_mem[CRASH_RESERVED_MEM_NR];
1a067e
+extern int crash_reserved_mem_nr;
1a067e
 
1a067e
 unsigned long read_vmcoreinfo_symbol(char *str_symbol);
1a067e
 int readmem(int type_addr, unsigned long long addr, void *bufptr, size_t size);
1a067e
-- 
1a067e
2.7.5
1a067e