Blob Blame History Raw
From efa29d476996a20052be80878767cfe09e4b6224 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 29 Jan 2020 10:59:08 +0800
Subject: [PATCH] makedumpfile: Remove duplicated variable declarations

When building on Fedora 32, following error is observed:

/usr/bin/ld: erase_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:2010:
multiple definition of `crash_reserved_mem_nr'; elf_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:2010: first defined here
/usr/bin/ld: erase_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:2009:
multiple definition of `crash_reserved_mem'; elf_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:2009: first defined here
/usr/bin/ld: erase_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:1278:
multiple definition of `parallel_info_t'; elf_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:1278: first defined here
/usr/bin/ld: erase_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:1265:
multiple definition of `splitting_info_t'; elf_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:1265: first defined here

And apparently, these variables are wrongly declared multiple times. So
remove duplicated declaration.

Signed-off-by: Kairui Song <kasong@redhat.com>
---
 makedumpfile.c |  2 ++
 makedumpfile.h | 10 ++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index e290fbd..9aad77b 100644
--- a/makedumpfile-1.6.7/makedumpfile.c
+++ b/makedumpfile-1.6.7/makedumpfile.c
@@ -34,6 +34,8 @@ struct array_table	array_table;
 struct number_table	number_table;
 struct srcfile_table	srcfile_table;
 struct save_control	sc;
+struct parallel_info	parallel_info_t;
+struct splitting_info	splitting_info_t;
 
 struct vm_table		vt = { 0 };
 struct DumpInfo		*info = NULL;
diff --git a/makedumpfile.h b/makedumpfile.h
index 68d9691..614764c 100644
--- a/makedumpfile-1.6.7/makedumpfile.h
+++ b/makedumpfile-1.6.7/makedumpfile.h
@@ -1262,7 +1262,8 @@ struct splitting_info {
 	mdf_pfn_t		end_pfn;
 	off_t			offset_eraseinfo;
 	unsigned long		size_eraseinfo;
-} splitting_info_t;
+};
+extern struct splitting_info splitting_info_t;
 
 struct parallel_info {
 	int			fd_memory;
@@ -1275,7 +1276,8 @@ struct parallel_info {
 #ifdef USELZO
 	lzo_bytep		wrkmem;
 #endif
-} parallel_info_t;
+};
+extern struct parallel_info parallel_info_t;
 
 struct ppc64_vmemmap {
 	unsigned long		phys;
@@ -2006,8 +2008,8 @@ struct memory_range {
 };
 
 #define CRASH_RESERVED_MEM_NR   8
-struct memory_range crash_reserved_mem[CRASH_RESERVED_MEM_NR];
-int crash_reserved_mem_nr;
+extern struct memory_range crash_reserved_mem[CRASH_RESERVED_MEM_NR];
+extern int crash_reserved_mem_nr;
 
 unsigned long read_vmcoreinfo_symbol(char *str_symbol);
 int readmem(int type_addr, unsigned long long addr, void *bufptr, size_t size);
-- 
2.24.1