From 08f72c5a4157b3408230cd1b173572847eaee6e9 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 1 Jun 2017 14:10:45 +0200 Subject: sparc: add gcc7 fix from upstream linux --- target/config/Config.in.compiler | 1 - ...0001-sparc-Fix-Wstringop-overflow-warning.patch | 76 ++++++++++++++++++++++ ...0001-sparc-Fix-Wstringop-overflow-warning.patch | 76 ++++++++++++++++++++++ 3 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 target/linux/patches/4.11.3/0001-sparc-Fix-Wstringop-overflow-warning.patch create mode 100644 target/linux/patches/4.9.30/0001-sparc-Fix-Wstringop-overflow-warning.patch diff --git a/target/config/Config.in.compiler b/target/config/Config.in.compiler index 3725a1874..5473fd472 100644 --- a/target/config/Config.in.compiler +++ b/target/config/Config.in.compiler @@ -24,7 +24,6 @@ default ADK_TOOLCHAIN_GCC_4_4 if ADK_TARGET_ARCH_AVR32 default ADK_TOOLCHAIN_GCC_4_9 if ADK_TARGET_ARCH_LM32 && !ADK_TARGET_LIB_NEWLIB default ADK_TOOLCHAIN_GCC_4_9 if ADK_TARGET_LIB_GLIBC && ADK_TARGET_ARCH_SH default ADK_TOOLCHAIN_GCC_4_9 if ADK_TARGET_SYSTEM_KINETIS_K70 -default ADK_TOOLCHAIN_GCC_6 if ADK_TARGET_ARCH_SPARC default ADK_TOOLCHAIN_GCC_7 config ADK_TOOLCHAIN_GCC_GIT diff --git a/target/linux/patches/4.11.3/0001-sparc-Fix-Wstringop-overflow-warning.patch b/target/linux/patches/4.11.3/0001-sparc-Fix-Wstringop-overflow-warning.patch new file mode 100644 index 000000000..2782fc451 --- /dev/null +++ b/target/linux/patches/4.11.3/0001-sparc-Fix-Wstringop-overflow-warning.patch @@ -0,0 +1,76 @@ +From deba804c90642c8ed0f15ac1083663976d578f54 Mon Sep 17 00:00:00 2001 +From: Orlando Arias +Date: Tue, 16 May 2017 15:34:00 -0400 +Subject: [PATCH] sparc: Fix -Wstringop-overflow warning + +Greetings, + +GCC 7 introduced the -Wstringop-overflow flag to detect buffer overflows +in calls to string handling functions [1][2]. Due to the way +``empty_zero_page'' is declared in arch/sparc/include/setup.h, this +causes a warning to trigger at compile time in the function mem_init(), +which is subsequently converted to an error. The ensuing patch fixes +this issue and aligns the declaration of empty_zero_page to that of +other architectures. Thank you. + +Cheers, +Orlando. + +[1] https://gcc.gnu.org/ml/gcc-patches/2016-10/msg02308.html +[2] https://gcc.gnu.org/gcc-7/changes.html + +Signed-off-by: Orlando Arias + +-------------------------------------------------------------------------------- +Signed-off-by: David S. Miller +--- + arch/sparc/include/asm/pgtable_32.h | 4 ++-- + arch/sparc/include/asm/setup.h | 2 +- + arch/sparc/mm/init_32.c | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h +index ce6f569..cf19072 100644 +--- a/arch/sparc/include/asm/pgtable_32.h ++++ b/arch/sparc/include/asm/pgtable_32.h +@@ -91,9 +91,9 @@ extern unsigned long pfn_base; + * ZERO_PAGE is a global shared page that is always zero: used + * for zero-mapped memory areas etc.. + */ +-extern unsigned long empty_zero_page; ++extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; + +-#define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page)) ++#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) + + /* + * In general all page table modifications should use the V8 atomic +diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h +index 478bf6bb..3fae200 100644 +--- a/arch/sparc/include/asm/setup.h ++++ b/arch/sparc/include/asm/setup.h +@@ -16,7 +16,7 @@ extern char reboot_command[]; + */ + extern unsigned char boot_cpu_id; + +-extern unsigned long empty_zero_page; ++extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; + + extern int serial_console; + static inline int con_is_present(void) +diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c +index c6afe98..3bd0d51 100644 +--- a/arch/sparc/mm/init_32.c ++++ b/arch/sparc/mm/init_32.c +@@ -290,7 +290,7 @@ void __init mem_init(void) + + + /* Saves us work later. */ +- memset((void *)&empty_zero_page, 0, PAGE_SIZE); ++ memset((void *)empty_zero_page, 0, PAGE_SIZE); + + i = last_valid_pfn >> ((20 - PAGE_SHIFT) + 5); + i += 1; +-- +2.1.4 + diff --git a/target/linux/patches/4.9.30/0001-sparc-Fix-Wstringop-overflow-warning.patch b/target/linux/patches/4.9.30/0001-sparc-Fix-Wstringop-overflow-warning.patch new file mode 100644 index 000000000..2782fc451 --- /dev/null +++ b/target/linux/patches/4.9.30/0001-sparc-Fix-Wstringop-overflow-warning.patch @@ -0,0 +1,76 @@ +From deba804c90642c8ed0f15ac1083663976d578f54 Mon Sep 17 00:00:00 2001 +From: Orlando Arias +Date: Tue, 16 May 2017 15:34:00 -0400 +Subject: [PATCH] sparc: Fix -Wstringop-overflow warning + +Greetings, + +GCC 7 introduced the -Wstringop-overflow flag to detect buffer overflows +in calls to string handling functions [1][2]. Due to the way +``empty_zero_page'' is declared in arch/sparc/include/setup.h, this +causes a warning to trigger at compile time in the function mem_init(), +which is subsequently converted to an error. The ensuing patch fixes +this issue and aligns the declaration of empty_zero_page to that of +other architectures. Thank you. + +Cheers, +Orlando. + +[1] https://gcc.gnu.org/ml/gcc-patches/2016-10/msg02308.html +[2] https://gcc.gnu.org/gcc-7/changes.html + +Signed-off-by: Orlando Arias + +-------------------------------------------------------------------------------- +Signed-off-by: David S. Miller +--- + arch/sparc/include/asm/pgtable_32.h | 4 ++-- + arch/sparc/include/asm/setup.h | 2 +- + arch/sparc/mm/init_32.c | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h +index ce6f569..cf19072 100644 +--- a/arch/sparc/include/asm/pgtable_32.h ++++ b/arch/sparc/include/asm/pgtable_32.h +@@ -91,9 +91,9 @@ extern unsigned long pfn_base; + * ZERO_PAGE is a global shared page that is always zero: used + * for zero-mapped memory areas etc.. + */ +-extern unsigned long empty_zero_page; ++extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; + +-#define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page)) ++#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) + + /* + * In general all page table modifications should use the V8 atomic +diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h +index 478bf6bb..3fae200 100644 +--- a/arch/sparc/include/asm/setup.h ++++ b/arch/sparc/include/asm/setup.h +@@ -16,7 +16,7 @@ extern char reboot_command[]; + */ + extern unsigned char boot_cpu_id; + +-extern unsigned long empty_zero_page; ++extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; + + extern int serial_console; + static inline int con_is_present(void) +diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c +index c6afe98..3bd0d51 100644 +--- a/arch/sparc/mm/init_32.c ++++ b/arch/sparc/mm/init_32.c +@@ -290,7 +290,7 @@ void __init mem_init(void) + + + /* Saves us work later. */ +- memset((void *)&empty_zero_page, 0, PAGE_SIZE); ++ memset((void *)empty_zero_page, 0, PAGE_SIZE); + + i = last_valid_pfn >> ((20 - PAGE_SHIFT) + 5); + i += 1; +-- +2.1.4 + -- cgit v1.2.3