All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmk+kernel@armlinux.org.uk (Russell King)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] ARM: mark critical data with KEEP()
Date: Tue, 06 Nov 2018 13:40:14 +0000	[thread overview]
Message-ID: <E1gK1aY-0000ob-RQ@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20181106133935.GB30658@n2100.armlinux.org.uk>

In order for GC sections to work correctly, we need to instruct the
linker to emit all input sections for entry paths and some linker
built tables.

Ensure that the vectors, tag table, CPU table, machine platform table,
and exception tables are kept.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 arch/arm/kernel/vmlinux.lds.S | 10 +++++-----
 arch/arm/kernel/vmlinux.lds.h | 18 +++++++++---------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 23150c0f0f4d..3da8db076761 100644
--- 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))
+		ARM_MMU_KEEP(KEEP(*(__ex_table)))
 		__stop___ex_table = .;
 	}
 
@@ -100,24 +100,24 @@ SECTIONS
 	}
 	.init.arch.info : {
 		__arch_info_begin = .;
-		*(.arch.info.init)
+		KEEP(*(.arch.info.init))
 		__arch_info_end = .;
 	}
 	.init.tagtable : {
 		__tagtable_begin = .;
-		*(.taglist.init)
+		KEEP(*(.taglist.init))
 		__tagtable_end = .;
 	}
 #ifdef CONFIG_SMP_ON_UP
 	.init.smpalt : {
 		__smpalt_begin = .;
-		*(.alt.smp.init)
+		KEEP(*(.alt.smp.init))
 		__smpalt_end = .;
 	}
 #endif
 	.init.pv_table : {
 		__pv_table_begin = .;
-		*(.pv_table)
+		KEEP(*(.pv_table))
 		__pv_table_end = .;
 	}
 
diff --git a/arch/arm/kernel/vmlinux.lds.h b/arch/arm/kernel/vmlinux.lds.h
index 8247bc15addc..a83d017f531c 100644
--- a/arch/arm/kernel/vmlinux.lds.h
+++ b/arch/arm/kernel/vmlinux.lds.h
@@ -28,22 +28,22 @@
 #define PROC_INFO							\
 		. = ALIGN(4);						\
 		__proc_info_begin = .;					\
-		*(.proc.info.init)					\
+		KEEP(*(.proc.info.init))				\
 		__proc_info_end = .;
 
 #define HYPERVISOR_TEXT							\
 		__hyp_text_start = .;					\
-		*(.hyp.text)						\
+		KEEP(*(.hyp.text))					\
 		__hyp_text_end = .;
 
 #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							\
@@ -64,7 +64,7 @@
 #define ARM_TEXT							\
 		IDMAP_TEXT						\
 		__entry_text_start = .;					\
-		*(.entry.text)						\
+		KEEP(*(.entry.text))					\
 		__entry_text_end = .;					\
 		IRQENTRY_TEXT						\
 		SOFTIRQENTRY_TEXT					\
@@ -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 = .;						\
-- 
2.7.4

  parent reply	other threads:[~2018-11-06 13:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 13:39 [PATCH 0/4] Enable deadcode elimination at link time Russell King - ARM Linux
2018-11-06 13:39 ` Russell King - ARM Linux
2018-11-06 13:40 ` [PATCH 1/4] EFI stub: remove -fdata-sections Russell King
2018-11-06 13:40   ` Russell King
2018-11-06 14:11   ` Ard Biesheuvel
2018-11-06 14:11     ` Ard Biesheuvel
2018-11-06 14:21     ` Russell King - ARM Linux
2018-11-06 14:21       ` Russell King - ARM Linux
2018-11-06 14:22       ` Ard Biesheuvel
2018-11-06 14:22         ` Ard Biesheuvel
2018-11-06 13:40 ` Russell King [this message]
2018-11-06 13:40 ` [PATCH 3/4] ARM: merge -fdata-sections BSS data to .bss section Russell King
2018-11-06 14:08   ` Ard Biesheuvel
2018-11-06 14:10     ` Russell King - ARM Linux
2018-11-06 14:13       ` Ard Biesheuvel
2018-11-06 14:29         ` Russell King - ARM Linux
2018-11-06 14:39           ` Ard Biesheuvel
2018-11-06 14:45             ` Russell King - ARM Linux
2018-11-06 15:18               ` Ard Biesheuvel
2018-11-06 16:06                 ` Russell King - ARM Linux
2018-11-06 16:14                   ` Ard Biesheuvel
2018-11-06 13:40 ` [PATCH 4/4] ARM: enable LD_DEAD_CODE_DATA_ELIMINATION Russell King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1gK1aY-0000ob-RQ@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.