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

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