[PATCH 6/6] MIPS: Use thin archives & dead code elimination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Enable CONFIG_THIN_ARCHIVES & CONFIG_LD_DEAD_CODE_DATA_ELIMINATION for
MIPS, ensuring that we keep the data bus exception table & the machine
list which would be discarded without marking them with KEEP.

This shrinks a typical generic kernel build with drivers enabled for
Boston, Ci40 & SEAD-3 by around 5%, or ~450kb. As reported by
bloat-o-meter:

  add/remove: 0/3028 grow/shrink: 1/14 up/down: 18/-457362 (-457344)
  ...
  Total: Before=9001030, After=8543686, chg -5.08%

Signed-off-by: Paul Burton <paul.burton@xxxxxxxxxx>
Cc: linux-mips@xxxxxxxxxxxxxx
Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
Cc: Nicholas Piggin <npiggin@xxxxxxxxx>

---

 arch/mips/Kconfig              | 2 ++
 arch/mips/kernel/vmlinux.lds.S | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b3c5bde..8557667 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -66,6 +66,8 @@ config MIPS
 	select HAVE_EXIT_THREAD
 	select HAVE_REGS_AND_STACK_ACCESS_API
 	select HAVE_ARCH_HARDENED_USERCOPY
+	select THIN_ARCHIVES
+	select LD_DEAD_CODE_DATA_ELIMINATION
 
 menu "Machine selection"
 
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index d1f5401..a43ba2a 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -72,7 +72,7 @@ SECTIONS
 	/* Exception table for data bus errors */
 	__dbe_table : {
 		__start___dbe_table = .;
-		*(__dbe_table)
+		KEEP(*(__dbe_table))
 		__stop___dbe_table = .;
 	}
 
@@ -122,7 +122,7 @@ SECTIONS
 	. = ALIGN(4);
 	.mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) {
 		__mips_machines_start = .;
-		*(.mips.machines.init)
+		KEEP(*(.mips.machines.init))
 		__mips_machines_end = .;
 	}
 
-- 
2.10.0





[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux