[OpenWrt-Devel] [RFC 3/7] kexec-tools: add patch for fixing compilation warnings.

Yousong Zhou yszhou4tech at gmail.com
Fri Jan 23 08:52:08 EST 2015


Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 .../patches/103-fix-compilation-warnings.patch     |   79 ++++++++++++++++++++
 1 file changed, 79 insertions(+)
 create mode 100644 package/boot/kexec-tools/patches/103-fix-compilation-warnings.patch

diff --git a/package/boot/kexec-tools/patches/103-fix-compilation-warnings.patch b/package/boot/kexec-tools/patches/103-fix-compilation-warnings.patch
new file mode 100644
index 0000000..0c5e63d
--- /dev/null
+++ b/package/boot/kexec-tools/patches/103-fix-compilation-warnings.patch
@@ -0,0 +1,79 @@
+Index: kexec-tools-2.0.4/kexec/arch/mips/crashdump-mips.c
+===================================================================
+--- kexec-tools-2.0.4.orig/kexec/arch/mips/crashdump-mips.c	2013-03-14 16:49:17.000000000 +0800
++++ kexec-tools-2.0.4/kexec/arch/mips/crashdump-mips.c	2014-09-09 19:58:52.065772917 +0800
+@@ -22,6 +22,7 @@
+ #include <stdlib.h>
+ #include <errno.h>
+ #include <limits.h>
++#include <inttypes.h>
+ #include <elf.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+@@ -60,7 +61,7 @@
+ 
+ 	if (parse_iomem_single("Kernel code\n", &start, NULL) == 0) {
+ 		elf_info->kern_paddr_start = start;
+-		dbgprintf("kernel load physical addr start = 0x%lx\n", start);
++		dbgprintf("kernel load physical addr start = 0x%" PRIu64 "\n", start);
+ 		return 0;
+ 	}
+ 
+Index: kexec-tools-2.0.4/kexec/arch/mips/kexec-elf-mips.c
+===================================================================
+--- kexec-tools-2.0.4.orig/kexec/arch/mips/kexec-elf-mips.c	2014-09-09 19:55:06.256301994 +0800
++++ kexec-tools-2.0.4/kexec/arch/mips/kexec-elf-mips.c	2014-09-09 19:55:24.461064400 +0800
+@@ -161,7 +161,7 @@
+ 	if (info->kexec_flags & KEXEC_ON_CRASH)
+ 		/* In case of crashdump segment[0] is kernel.
+ 		 * Put cmdline just after it. */
+-		cmdline_addr = info->segment[0].mem +
++		cmdline_addr = (unsigned long)info->segment[0].mem +
+ 				info->segment[0].memsz;
+ 	else
+ 		cmdline_addr = 0;
+Index: kexec-tools-2.0.4/kexec/kexec-elf-rel.c
+===================================================================
+--- kexec-tools-2.0.4.orig/kexec/kexec-elf-rel.c	2013-03-15 23:51:02.000000000 +0800
++++ kexec-tools-2.0.4/kexec/kexec-elf-rel.c	2014-09-09 19:43:26.114936683 +0800
+@@ -347,6 +347,9 @@
+ 			else if (shdr->sh_type == SHT_RELA) {
+ 				rel = elf_rela(ehdr, ptr);
+ 			}
++			else {
++				die("Unexpected sh_type: %d\n", shdr->sh_type);
++			}
+ 			/* the location to change */
+ 			location = section->sh_data + rel.r_offset;
+ 
+@@ -513,7 +516,7 @@
+ 			name);
+ 	}
+ 	if (sym.st_size != size) {
+-		die("Symbol: %s has size: %lld not %ld\n",
++		die("Symbol: %s has size: %lld not %zd\n",
+ 			name, sym.st_size, size);
+ 	}
+ 	shdr = &ehdr->e_shdr[sym.st_shndx];
+@@ -537,7 +540,7 @@
+ 		die("Symbol: %s not found cannot get\n", name);
+ 	}
+ 	if (sym.st_size != size) {
+-		die("Symbol: %s has size: %lld not %ld\n",
++		die("Symbol: %s has size: %lld not %zd\n",
+ 			name, sym.st_size, size);
+ 	}
+ 	shdr = &ehdr->e_shdr[sym.st_shndx];
+Index: kexec-tools-2.0.4/kexec/kexec.h
+===================================================================
+--- kexec-tools-2.0.4.orig/kexec/kexec.h	2014-09-09 20:03:21.193060339 +0800
++++ kexec-tools-2.0.4/kexec/kexec.h	2014-09-09 20:03:26.757293978 +0800
+@@ -233,7 +233,7 @@
+ #define KEXEC_OPT_STR "hvdfxluet:p"
+ 
+ extern void die(const char *fmt, ...)
+-	__attribute__ ((format (printf, 1, 2)));
++	__attribute__ ((format (printf, 1, 2), noreturn));
+ extern void *xmalloc(size_t size);
+ extern void *xrealloc(void *ptr, size_t size);
+ extern char *slurp_file(const char *filename, off_t *r_size);
-- 
1.7.10.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list