[openwrt/openwrt] kernel/generic: fix the arm gc-sections patch

LEDE Commits lede-commits at lists.infradead.org
Sun Jul 25 04:58:41 PDT 2021


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/023a1366ee8138a8adbf3044814c1855c5677bb1

commit 023a1366ee8138a8adbf3044814c1855c5677bb1
Author: Rui Salvaterra <rsalvaterra at gmail.com>
AuthorDate: Fri Jul 23 13:34:49 2021 +0100

    kernel/generic: fix the arm gc-sections patch
    
    Latest binutils (2.37) exposed a long-standing bug. The kernel linking stage
    would break at the SORTTAB step, due to the exception table having been
    previously purged from vmlinux, as its section wasn't marked as unconditionally
    kept. Fix thusly.
    
    Additionally, the "#define ARM_MMU_DISCARD(x) KEEP(x)" change is bogus. It
    would only apply to !CONFIG_MMU devices (which we don't support in OpenWrt), and
    it would even break the build if referenced. Drop it.
    
    While at it, rename the patch in order to make it obvious that it's
    arm-specific.
    
    Signed-off-by: Rui Salvaterra <rsalvaterra at gmail.com>
    [Add same changes for kernel 5.4 too]
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 ...220-gc_sections.patch => 220-arm-gc_sections.patch} | 18 ++++++++++--------
 ...220-gc_sections.patch => 220-arm-gc_sections.patch} | 18 ++++++++++--------
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/target/linux/generic/hack-5.10/220-gc_sections.patch b/target/linux/generic/hack-5.10/220-arm-gc_sections.patch
similarity index 93%
rename from target/linux/generic/hack-5.10/220-gc_sections.patch
rename to target/linux/generic/hack-5.10/220-arm-gc_sections.patch
index 810c5aecf5..3b67eea250 100644
--- a/target/linux/generic/hack-5.10/220-gc_sections.patch
+++ b/target/linux/generic/hack-5.10/220-arm-gc_sections.patch
@@ -32,6 +32,15 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
  		 lib1funcs.o ashldi3.o bswapsdi2.o \
 --- a/arch/arm/kernel/vmlinux.lds.S
 +++ b/arch/arm/kernel/vmlinux.lds.S
+@@ -75,7 +75,7 @@ SECTIONS
+ 	. = ALIGN(4);
+ 	__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
+ 		__start___ex_table = .;
+-		ARM_MMU_KEEP(*(__ex_table))
++		KEEP(*(__ex_table))
+ 		__stop___ex_table = .;
+ 	}
+ 
 @@ -100,24 +100,24 @@ SECTIONS
  	}
  	.init.arch.info : {
@@ -63,14 +72,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
  
 --- a/arch/arm/include/asm/vmlinux.lds.h
 +++ b/arch/arm/include/asm/vmlinux.lds.h
-@@ -23,19 +23,19 @@
- #define ARM_MMU_DISCARD(x)
- #else
- #define ARM_MMU_KEEP(x)
--#define ARM_MMU_DISCARD(x)	x
-+#define ARM_MMU_DISCARD(x)	KEEP(x)
- #endif
- 
+@@ -29,13 +29,13 @@
  #define PROC_INFO							\
  		. = ALIGN(4);						\
  		__proc_info_begin = .;					\
diff --git a/target/linux/generic/hack-5.4/220-gc_sections.patch b/target/linux/generic/hack-5.4/220-arm-gc_sections.patch
similarity index 94%
rename from target/linux/generic/hack-5.4/220-gc_sections.patch
rename to target/linux/generic/hack-5.4/220-arm-gc_sections.patch
index 22276d4399..c7c985181c 100644
--- a/target/linux/generic/hack-5.4/220-gc_sections.patch
+++ b/target/linux/generic/hack-5.4/220-arm-gc_sections.patch
@@ -41,6 +41,15 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
  # but it is being used too early to link to meaningful stack_chk logic.
 --- a/arch/arm/kernel/vmlinux.lds.S
 +++ b/arch/arm/kernel/vmlinux.lds.S
+@@ -73,7 +73,7 @@ SECTIONS
+ 	. = ALIGN(4);
+ 	__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
+ 		__start___ex_table = .;
+-		ARM_MMU_KEEP(*(__ex_table))
++		KEEP(*(__ex_table))
+ 		__stop___ex_table = .;
+ 	}
+ 
 @@ -100,24 +100,24 @@ SECTIONS
  	}
  	.init.arch.info : {
@@ -72,14 +81,7 @@ Signed-off-by: Gabor Juhos <juhosg at openwrt.org>
  
 --- a/arch/arm/kernel/vmlinux.lds.h
 +++ b/arch/arm/kernel/vmlinux.lds.h
-@@ -22,13 +22,13 @@
- #define ARM_MMU_DISCARD(x)
- #else
- #define ARM_MMU_KEEP(x)
--#define ARM_MMU_DISCARD(x)	x
-+#define ARM_MMU_DISCARD(x)	KEEP(x)
- #endif
- 
+@@ -28,7 +28,7 @@
  #define PROC_INFO							\
  		. = ALIGN(4);						\
  		__proc_info_begin = .;					\



More information about the lede-commits mailing list