From 9261e7447ea7b8d33b70ff6ea008f2041a88e255 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 1 Nov 2018 18:01:44 +0100 Subject: kernel: Make the patches apply on top of 4.19 This makes the patches which were just copied in the previous commit apply on top of kernel 4.19. The patches in the backports-4.19 folder were checked if they are really in kernel 4.19 based on the title and only removed if they were found in the upstream kernel. The following additional patches form the pending folder went into upstream Linux 4.19: pending-4.19/171-usb-dwc2-Fix-inefficient-copy-of-unaligned-buffers.patch pending-4.19/190-2-5-e1000e-Fix-wrong-comment-related-to-link-detection.patch pending-4.19/478-mtd-spi-nor-Add-support-for-XM25QH64A-and-XM25QH128A.patch pending-4.19/479-mtd-spi-nor-add-eon-en25qh32.patch pending-4.19/950-tty-serial-exar-generalize-rs485-setup.patch pending-4.19/340-MIPS-mm-remove-mips_dma_mapping_error.patch Bigger changes were introduced to the m25p80 spi nor driver, as far as I saw it in the new code, it now has the functionality provided in this patch: pending-4.19/450-mtd-m25p80-allow-fallback-from-spi_flash_read-to-reg.patch Part of this patch went upstream independent of OpenWrt: hack-4.19/220-gc_sections.patch This patch was reworked to match the changes done upstream. The MIPS DMA API changed a lot, this patch was rewritten to match the new DMA handling: pending-4.19/341-MIPS-mm-remove-no-op-dma_map_ops-where-possible.patch I did bigger manual changes to the following patches and I am not 100% sure if they are all correct: pending-4.19/0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch pending-4.19/411-mtd-partial_eraseblock_write.patch pending-4.19/600-netfilter_conntrack_flush.patch pending-4.19/611-netfilter_match_bypass_default_table.patch pending-4.19/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch hack-4.19/211-host_tools_portability.patch hack-4.19/221-module_exports.patch hack-4.19/321-powerpc_crtsavres_prereq.patch hack-4.19/902-debloat_proc.patch This is based on patchset from Marko Ratkaj Signed-off-by: Hauke Mehrtens --- .../linux/generic/hack-4.19/220-gc_sections.patch | 226 ++++++++------------- 1 file changed, 80 insertions(+), 146 deletions(-) (limited to 'target/linux/generic/hack-4.19/220-gc_sections.patch') diff --git a/target/linux/generic/hack-4.19/220-gc_sections.patch b/target/linux/generic/hack-4.19/220-gc_sections.patch index d257232403..17fcc5cbd2 100644 --- a/target/linux/generic/hack-4.19/220-gc_sections.patch +++ b/target/linux/generic/hack-4.19/220-gc_sections.patch @@ -21,43 +21,43 @@ Signed-off-by: Gabor Juhos --- a/Makefile +++ b/Makefile -@@ -272,6 +272,11 @@ else +@@ -294,6 +294,11 @@ else scripts/Kbuild.include: ; include scripts/Kbuild.include +ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION -+KBUILD_CFLAGS_KERNEL += $(call cc-option,-ffunction-sections,) -+KBUILD_CFLAGS_KERNEL += $(call cc-option,-fdata-sections,) ++KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections ++LDFLAGS_vmlinux += --gc-sections +endif + # Read KERNELRELEASE from include/config/kernel.release (if it exists) KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) -@@ -788,11 +793,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH +@@ -785,11 +790,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif -ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION --KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) --KBUILD_CFLAGS += $(call cc-option,-fdata-sections,) +-KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections +-LDFLAGS_vmlinux += --gc-sections -endif - # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) - CHECKFLAGS += $(NOSTDINC_FLAGS) + --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig -@@ -91,6 +91,7 @@ config ARM +@@ -98,6 +98,7 @@ config ARM select HAVE_UID16 select HAVE_VIRT_CPU_ACCOUNTING_GEN select IRQ_FORCED_THREADING -+ select LD_DEAD_CODE_DATA_ELIMINATION ++ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION select MODULES_USE_ELF_REL + select NEED_DMA_MAP_STATE select NO_BOOTMEM - select OF_EARLY_FLATTREE if OF --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile -@@ -103,6 +103,7 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y) +@@ -106,6 +106,7 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y) ORIG_CFLAGS := $(KBUILD_CFLAGS) KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) endif @@ -67,80 +67,7 @@ Signed-off-by: Gabor Juhos # 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 -@@ -18,7 +18,7 @@ - #define PROC_INFO \ - . = ALIGN(4); \ - VMLINUX_SYMBOL(__proc_info_begin) = .; \ -- *(.proc.info.init) \ -+ KEEP(*(.proc.info.init)) \ - VMLINUX_SYMBOL(__proc_info_end) = .; - - #define HYPERVISOR_TEXT \ -@@ -29,11 +29,11 @@ - #define IDMAP_TEXT \ - ALIGN_FUNCTION(); \ - VMLINUX_SYMBOL(__idmap_text_start) = .; \ -- *(.idmap.text) \ -+ KEEP(*(.idmap.text)) \ - VMLINUX_SYMBOL(__idmap_text_end) = .; \ - . = ALIGN(PAGE_SIZE); \ - VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \ -- *(.hyp.idmap.text) \ -+ KEEP(*(.hyp.idmap.text)) \ - VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; - - #ifdef CONFIG_HOTPLUG_CPU -@@ -106,7 +106,7 @@ SECTIONS - _stext = .; /* Text and read-only data */ - IDMAP_TEXT - __exception_text_start = .; -- *(.exception.text) -+ KEEP(*(.exception.text)) - __exception_text_end = .; - IRQENTRY_TEXT - SOFTIRQENTRY_TEXT -@@ -135,7 +135,7 @@ SECTIONS - __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { - __start___ex_table = .; - #ifdef CONFIG_MMU -- *(__ex_table) -+ KEEP(*(__ex_table)) - #endif - __stop___ex_table = .; - } -@@ -147,12 +147,12 @@ SECTIONS - . = ALIGN(8); - .ARM.unwind_idx : { - __start_unwind_idx = .; -- *(.ARM.exidx*) -+ KEEP(*(.ARM.exidx*)) - __stop_unwind_idx = .; - } - .ARM.unwind_tab : { - __start_unwind_tab = .; -- *(.ARM.extab*) -+ KEEP(*(.ARM.extab*)) - __stop_unwind_tab = .; - } - #endif -@@ -172,14 +172,14 @@ SECTIONS - */ - __vectors_start = .; - .vectors 0xffff0000 : AT(__vectors_start) { -- *(.vectors) -+ KEEP(*(.vectors)) - } - . = __vectors_start + SIZEOF(.vectors); - __vectors_end = .; - - __stubs_start = .; - .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) { -- *(.stubs) -+ KEEP(*(.stubs)) - } - . = __stubs_start + SIZEOF(.stubs); - __stubs_end = .; -@@ -195,24 +195,24 @@ SECTIONS +@@ -100,24 +100,24 @@ SECTIONS } .init.arch.info : { __arch_info_begin = .; @@ -168,14 +95,78 @@ Signed-off-by: Gabor Juhos + KEEP(*(.pv_table)) __pv_table_end = .; } - .init.data : { + +--- 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 + + #define PROC_INFO \ + . = ALIGN(4); \ + __proc_info_begin = .; \ +- *(.proc.info.init) \ ++ KEEP(*(.proc.info.init)) \ + __proc_info_end = .; + + #define HYPERVISOR_TEXT \ +@@ -39,11 +39,11 @@ + #define IDMAP_TEXT \ + ALIGN_FUNCTION(); \ + __idmap_text_start = .; \ +- *(.idmap.text) \ ++ KEEP(*(.idmap.text)) \ + __idmap_text_end = .; \ + . = ALIGN(PAGE_SIZE); \ + __hyp_idmap_text_start = .; \ +- *(.hyp.idmap.text) \ ++ KEEP(*(.hyp.idmap.text)) \ + __hyp_idmap_text_end = .; + + #define ARM_DISCARD \ +@@ -86,12 +86,12 @@ + . = ALIGN(8); \ + .ARM.unwind_idx : { \ + __start_unwind_idx = .; \ +- *(.ARM.exidx*) \ ++ KEEP(*(.ARM.exidx*)) \ + __stop_unwind_idx = .; \ + } \ + .ARM.unwind_tab : { \ + __start_unwind_tab = .; \ +- *(.ARM.extab*) \ ++ KEEP(*(.ARM.extab*)) \ + __stop_unwind_tab = .; \ + } + +@@ -102,14 +102,14 @@ + #define ARM_VECTORS \ + __vectors_start = .; \ + .vectors 0xffff0000 : AT(__vectors_start) { \ +- *(.vectors) \ ++ KEEP(*(.vectors)) \ + } \ + . = __vectors_start + SIZEOF(.vectors); \ + __vectors_end = .; \ + \ + __stubs_start = .; \ + .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) { \ +- *(.stubs) \ ++ KEEP(*(.stubs)) \ + } \ + . = __stubs_start + SIZEOF(.stubs); \ + __stubs_end = .; \ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -40,6 +40,7 @@ config MIPS +@@ -43,6 +43,7 @@ config MIPS + select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT select HAVE_CBPF_JIT if (!64BIT && !CPU_MICROMIPS) select HAVE_EBPF_JIT if (64BIT && !CPU_MICROMIPS) - select HAVE_CC_STACKPROTECTOR -+ select LD_DEAD_CODE_DATA_ELIMINATION ++ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION select HAVE_CONTEXT_TRACKING select HAVE_COPY_THREAD_TLS select HAVE_C_RECORDMCOUNT @@ -199,60 +190,3 @@ Signed-off-by: Gabor Juhos __mips_machines_end = .; } ---- a/include/asm-generic/vmlinux.lds.h -+++ b/include/asm-generic/vmlinux.lds.h -@@ -105,7 +105,7 @@ - #ifdef CONFIG_FTRACE_MCOUNT_RECORD - #define MCOUNT_REC() . = ALIGN(8); \ - VMLINUX_SYMBOL(__start_mcount_loc) = .; \ -- *(__mcount_loc) \ -+ KEEP(*(__mcount_loc)) \ - VMLINUX_SYMBOL(__stop_mcount_loc) = .; - #else - #define MCOUNT_REC() -@@ -113,7 +113,7 @@ - - #ifdef CONFIG_TRACE_BRANCH_PROFILING - #define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \ -- *(_ftrace_annotated_branch) \ -+ KEEP(*(_ftrace_annotated_branch)) \ - VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .; - #else - #define LIKELY_PROFILE() -@@ -121,7 +121,7 @@ - - #ifdef CONFIG_PROFILE_ALL_BRANCHES - #define BRANCH_PROFILE() VMLINUX_SYMBOL(__start_branch_profile) = .; \ -- *(_ftrace_branch) \ -+ KEEP(*(_ftrace_branch)) \ - VMLINUX_SYMBOL(__stop_branch_profile) = .; - #else - #define BRANCH_PROFILE() -@@ -237,7 +237,8 @@ - LIKELY_PROFILE() \ - BRANCH_PROFILE() \ - TRACE_PRINTKS() \ -- TRACEPOINT_STR() -+ TRACEPOINT_STR() \ -+ *(.data.[a-zA-Z_]*) - - /* - * Data section helpers -@@ -496,7 +497,7 @@ - #define ENTRY_TEXT \ - ALIGN_FUNCTION(); \ - VMLINUX_SYMBOL(__entry_text_start) = .; \ -- *(.entry.text) \ -+ KEEP(*(.entry.text)) \ - VMLINUX_SYMBOL(__entry_text_end) = .; - - #define IRQENTRY_TEXT \ -@@ -603,7 +604,7 @@ - . = ALIGN(sbss_align); \ - .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \ - *(.dynsbss) \ -- *(.sbss) \ -+ *(.sbss .sbss.*) \ - *(.scommon) \ - } - -- cgit v1.2.3