Fix builing failure on Fedora 32

Signed-off-by: Kairui Song <kasong@redhat.com>
This commit is contained in:
Kairui Song 2020-01-29 12:30:24 +08:00
parent 71d20dc825
commit 47f2a819d5
4 changed files with 217 additions and 0 deletions

View File

@ -0,0 +1,98 @@
From 23daba8bb97ff4291447e54859ed759cfe07975e Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 29 Jan 2020 10:48:27 +0800
Subject: [PATCH] kexec-tools: Remove duplicated variable declarations
When building kexec-tools for Fedora 32, following error is observed:
/usr/bin/ld: kexec/arch/x86_64/kexec-bzImage64.o:(.bss+0x0): multiple definition of `bzImage_support_efi_boot';
kexec/arch/i386/kexec-bzImage.o:(.bss+0x0): first defined here
/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm/../../fs2dt.h:33: multiple definition of `my_debug';
kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/kexec/fs2dt.h:33: first defined here
/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:68: multiple definition of `arm64_mem';
kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:68: first defined here
/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:54: multiple definition of `initrd_size';
kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:54: first defined here
/builddir/build/BUILD/kexec-tools-2.0.20/kexec/arch/arm64/kexec-arm64.h:53: multiple definition of `initrd_base';
kexec/fs2dt.o:/builddir/build/BUILD/kexec-tools-2.0.20/././kexec/arch/arm64/kexec-arm64.h:53: first defined here
And apparently, these variables are wrongly declared multiple times. So
remove duplicated declaration.
Signed-off-by: Kairui Song <kasong@redhat.com>
---
kexec/arch/arm64/kexec-arm64.h | 6 +++---
kexec/arch/ppc64/kexec-elf-ppc64.c | 2 --
kexec/arch/x86_64/kexec-bzImage64.c | 1 -
kexec/fs2dt.h | 2 +-
4 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/kexec/arch/arm64/kexec-arm64.h b/kexec/arch/arm64/kexec-arm64.h
index 628de79..ed447ac 100644
--- a/kexec/arch/arm64/kexec-arm64.h
+++ b/kexec/arch/arm64/kexec-arm64.h
@@ -50,8 +50,8 @@ int zImage_arm64_load(int argc, char **argv, const char *kernel_buf,
void zImage_arm64_usage(void);
-off_t initrd_base;
-off_t initrd_size;
+extern off_t initrd_base;
+extern off_t initrd_size;
/**
* struct arm64_mem - Memory layout info.
@@ -65,7 +65,7 @@ struct arm64_mem {
};
#define arm64_mem_ngv UINT64_MAX
-struct arm64_mem arm64_mem;
+extern struct arm64_mem arm64_mem;
uint64_t get_phys_offset(void);
uint64_t get_vp_offset(void);
diff --git a/kexec/arch/ppc64/kexec-elf-ppc64.c b/kexec/arch/ppc64/kexec-elf-ppc64.c
index 3510b70..695b8b0 100644
--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
+++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
@@ -44,8 +44,6 @@
uint64_t initrd_base, initrd_size;
unsigned char reuse_initrd = 0;
const char *ramdisk;
-/* Used for enabling printing message from purgatory code */
-int my_debug = 0;
int elf_ppc64_probe(const char *buf, off_t len)
{
diff --git a/kexec/arch/x86_64/kexec-bzImage64.c b/kexec/arch/x86_64/kexec-bzImage64.c
index 8edb3e4..ba8dc48 100644
--- a/kexec/arch/x86_64/kexec-bzImage64.c
+++ b/kexec/arch/x86_64/kexec-bzImage64.c
@@ -42,7 +42,6 @@
#include <arch/options.h>
static const int probe_debug = 0;
-int bzImage_support_efi_boot;
int bzImage64_probe(const char *buf, off_t len)
{
diff --git a/kexec/fs2dt.h b/kexec/fs2dt.h
index 7633273..fe24931 100644
--- a/kexec/fs2dt.h
+++ b/kexec/fs2dt.h
@@ -30,7 +30,7 @@ extern struct bootblock bb[1];
/* Used for enabling printing message from purgatory code
* Only has implemented for PPC64 */
-int my_debug;
+extern int my_debug;
extern int dt_no_old_root;
void reserve(unsigned long long where, unsigned long long length);
--
2.24.1

View File

@ -0,0 +1,36 @@
From 2837fb1f5f8362976c188b30ebe50dc8b0377f64 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 29 Jan 2020 11:33:18 +0800
Subject: [PATCH] Remove duplicated variable declaration
When building on Fedora 32, following error is observed:
...
/usr/bin/ld: ../eppic/libeppic/libeppic.a(eppic_stat.o):/builddir/build/BUILD/kexec-tools-2.0.20/eppic/libeppic/eppic.h:474: multiple definition of `lastv';
../eppic/libeppic/libeppic.a(eppic_func.o):/builddir/build/BUILD/kexec-tools-2.0.20/eppic/libeppic/eppic.h:474: first defined here
...
And apparently, the variable is wrongly declared multiple times. So
remove duplicated declaration.
Signed-off-by: Kairui Song <kasong@redhat.com>
---
libeppic/eppic.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libeppic/eppic.h b/libeppic/eppic.h
index 5664583..836b475 100644
--- a/eppic-d84c3541035d95077aa8571f5d5c3e07c6ef510b/libeppic/eppic.h
+++ b/eppic-d84c3541035d95077aa8571f5d5c3e07c6ef510b/libeppic/eppic.h
@@ -471,7 +471,7 @@ type_t *eppic_addstorage(type_t *t1, type_t *t2);
type_t *eppic_getvoidstruct(int ctype);
extern int lineno, needvar, instruct, nomacs, eppic_legacy;
-node_t *lastv;
+extern node_t *lastv;
#define NULLNODE ((node_t*)0)
--
2.24.1

View File

@ -0,0 +1,76 @@
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

View File

@ -97,6 +97,9 @@ Patch0: kexec-tools-2.0.20-fix-broken-multiboot2-buliding-for-i386.patch
#
# Patches 601 onward are generic patches
#
Patch601: ./kexec-tools-2.0.20-eppic-Remove-duplicated-variable-declaration.patch
Patch602: ./kexec-tools-2.0.20-makedumpfile-Remove-duplicated-variable-declarations.patch
Patch603: ./kexec-tools-2.0.20-Remove-duplicated-variable-declarations.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@ -114,6 +117,10 @@ tar -z -x -v -f %{SOURCE19}
%patch0 -p1
%patch601 -p1
%patch602 -p1
%patch603 -p1
%ifarch ppc
%define archdef ARCH=ppc
%endif