Advertisement
Guest User

Untitled

a guest
Jun 21st, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.81 KB | None | 0 0
  1. commit 6ea15ff33fe825577346d10d6588a3f4379b6f83
  2. Author: Arnd Bergmann <arnd@arndb.de>
  3. Date:   Sat Aug 6 22:46:26 2016 +0200
  4.  
  5.     [EXPERIMENTAL, v3] enable thin archives and --gc-sections on ARM
  6.    
  7.     I'm still build testing with an experimental change to enable
  8.     thin architeves and --gc-sections on ARM, which should bring
  9.     multiple benefits
  10.    
  11.     - improve build times
  12.     - allow 'allyesconfig' to succeed without exceeding the
  13.       section size when linking drivers/built-in.o
  14.     - reduce the kernel image size
  15.    
  16.     Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  17.  
  18. diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
  19. index 5a5399b711c6..b827337a51b5 100644
  20. --- a/arch/arm/Kconfig
  21. +++ b/arch/arm/Kconfig
  22. @@ -91,6 +91,7 @@ config ARM
  23.     select HAVE_UID16
  24.     select HAVE_VIRT_CPU_ACCOUNTING_GEN
  25.     select IRQ_FORCED_THREADING
  26. +   select LD_DEAD_CODE_DATA_ELIMINATION
  27.     select MODULES_USE_ELF_REL
  28.     select NO_BOOTMEM
  29.     select OF_EARLY_FLATTREE if OF
  30. @@ -100,6 +101,7 @@ config ARM
  31.     select PERF_USE_VMALLOC
  32.     select RTC_LIB
  33.     select SYS_SUPPORTS_APM_EMULATION
  34. +   select THIN_ARCHIVES
  35.     # Above selects are sorted alphabetically; please add new ones
  36.     # according to that.  Thanks.
  37.     help
  38. diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
  39. index d1b06cd79b23..469b78f5f529 100644
  40. --- a/arch/arm/kernel/Makefile
  41. +++ b/arch/arm/kernel/Makefile
  42. @@ -13,6 +13,9 @@ endif
  43.  
  44.  CFLAGS_REMOVE_return_address.o = -pg
  45.  
  46. +ccflags-y              += -fno-function-sections -fno-data-sections
  47. +subdir-ccflags-y       += -fno-function-sections -fno-data-sections
  48. +
  49.  # Object file lists.
  50.  
  51.  obj-y      := elf.o entry-common.o irq.o opcodes.o \
  52. diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S
  53. index 004b7da48218..6ab1816d995a 100644
  54. --- a/arch/arm/kernel/vmlinux-xip.lds.S
  55. +++ b/arch/arm/kernel/vmlinux-xip.lds.S
  56. @@ -15,17 +15,17 @@
  57.  #define PROC_INFO                          \
  58.     . = ALIGN(4);                           \
  59.     VMLINUX_SYMBOL(__proc_info_begin) = .;              \
  60. -   *(.proc.info.init)                      \
  61. +   KEEP(*(.proc.info.init))                    \
  62.     VMLINUX_SYMBOL(__proc_info_end) = .;
  63.  
  64.  #define IDMAP_TEXT                         \
  65.     ALIGN_FUNCTION();                       \
  66.     VMLINUX_SYMBOL(__idmap_text_start) = .;             \
  67. -   *(.idmap.text)                          \
  68. +   KEEP(*(.idmap.text))                        \
  69.     VMLINUX_SYMBOL(__idmap_text_end) = .;               \
  70.     . = ALIGN(PAGE_SIZE);                       \
  71.     VMLINUX_SYMBOL(__hyp_idmap_text_start) = .;         \
  72. -   *(.hyp.idmap.text)                      \
  73. +   KEEP(*(.hyp.idmap.text))                    \
  74.     VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
  75.  
  76.  #ifdef CONFIG_HOTPLUG_CPU
  77. @@ -45,6 +45,16 @@
  78.  #define ARM_EXIT_DISCARD(x)    x
  79.  #endif
  80.  
  81. +#undef TEXT_TEXT
  82. +#define TEXT_TEXT                          \
  83. +       ALIGN_FUNCTION();                   \
  84. +       *(.text.hot .text.hot.*)                \
  85. +       *(.text.unlikely .text.unlikely.*)          \
  86. +       *(.text .text.*)                    \
  87. +       *(.ref.text)                        \
  88. +   MEM_KEEP(init.text)                     \
  89. +   MEM_KEEP(exit.text)                     \
  90. +
  91.  OUTPUT_ARCH(arm)
  92.  ENTRY(stext)
  93.  
  94. @@ -118,7 +128,7 @@ SECTIONS
  95.     __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
  96.         __start___ex_table = .;
  97.  #ifdef CONFIG_MMU
  98. -       *(__ex_table)
  99. +       KEEP(*(__ex_table))
  100.  #endif
  101.         __stop___ex_table = .;
  102.     }
  103. @@ -130,12 +140,12 @@ SECTIONS
  104.     . = ALIGN(8);
  105.     .ARM.unwind_idx : {
  106.         __start_unwind_idx = .;
  107. -       *(.ARM.exidx*)
  108. +       KEEP(*(.ARM.exidx*))
  109.         __stop_unwind_idx = .;
  110.     }
  111.     .ARM.unwind_tab : {
  112.         __start_unwind_tab = .;
  113. -       *(.ARM.extab*)
  114. +       KEEP(*(.ARM.extab*))
  115.         __stop_unwind_tab = .;
  116.     }
  117.  #endif
  118. @@ -150,7 +160,7 @@ SECTIONS
  119.      */
  120.     __vectors_start = .;
  121.     .vectors 0xffff0000 : AT(__vectors_start) {
  122. -       *(.vectors)
  123. +       KEEP(*(.vectors))
  124.     }
  125.     . = __vectors_start + SIZEOF(.vectors);
  126.     __vectors_end = .;
  127. @@ -173,24 +183,24 @@ SECTIONS
  128.     }
  129.     .init.arch.info : {
  130.         __arch_info_begin = .;
  131. -       *(.arch.info.init)
  132. +       KEEP(*(.arch.info.init))
  133.         __arch_info_end = .;
  134.     }
  135.     .init.tagtable : {
  136.         __tagtable_begin = .;
  137. -       *(.taglist.init)
  138. +       KEEP(*(.taglist.init))
  139.         __tagtable_end = .;
  140.     }
  141.  #ifdef CONFIG_SMP_ON_UP
  142.     .init.smpalt : {
  143.         __smpalt_begin = .;
  144. -       *(.alt.smp.init)
  145. +       KEEP(*(.alt.smp.init))
  146.         __smpalt_end = .;
  147.     }
  148.  #endif
  149.     .init.pv_table : {
  150.         __pv_table_begin = .;
  151. -       *(.pv_table)
  152. +       KEEP(*(.pv_table))
  153.         __pv_table_end = .;
  154.     }
  155.     .init.data : {
  156. diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
  157. index 823d18b39725..161822dc7cac 100644
  158. --- a/arch/arm/kernel/vmlinux.lds.S
  159. +++ b/arch/arm/kernel/vmlinux.lds.S
  160. @@ -17,7 +17,7 @@
  161.  #define PROC_INFO                          \
  162.     . = ALIGN(4);                           \
  163.     VMLINUX_SYMBOL(__proc_info_begin) = .;              \
  164. -   *(.proc.info.init)                      \
  165. +   KEEP(*(.proc.info.init))                    \
  166.     VMLINUX_SYMBOL(__proc_info_end) = .;
  167.  
  168.  #define HYPERVISOR_TEXT                            \
  169. @@ -35,6 +35,16 @@
  170.     *(.hyp.idmap.text)                      \
  171.     VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
  172.  
  173. +#undef TEXT_TEXT
  174. +#define TEXT_TEXT                          \
  175. +       ALIGN_FUNCTION();                   \
  176. +       *(.text.hot .text.hot.*)                \
  177. +       *(.text.unlikely .text.unlikely.*)          \
  178. +       *(.text .text.*)                    \
  179. +       *(.ref.text)                        \
  180. +   MEM_KEEP(init.text)                     \
  181. +   MEM_KEEP(exit.text)                     \
  182. +
  183.  #ifdef CONFIG_HOTPLUG_CPU
  184.  #define ARM_CPU_DISCARD(x)
  185.  #define ARM_CPU_KEEP(x)        x
  186. @@ -170,7 +180,7 @@ SECTIONS
  187.      */
  188.     __vectors_start = .;
  189.     .vectors 0xffff0000 : AT(__vectors_start) {
  190. -       *(.vectors)
  191. +       KEEP(*(.vectors))
  192.     }
  193.     . = __vectors_start + SIZEOF(.vectors);
  194.     __vectors_end = .;
  195. @@ -193,24 +203,24 @@ SECTIONS
  196.     }
  197.     .init.arch.info : {
  198.         __arch_info_begin = .;
  199. -       *(.arch.info.init)
  200. +       KEEP(*(.arch.info.init))
  201.         __arch_info_end = .;
  202.     }
  203.     .init.tagtable : {
  204.         __tagtable_begin = .;
  205. -       *(.taglist.init)
  206. +       KEEP(*(.taglist.init))
  207.         __tagtable_end = .;
  208.     }
  209.  #ifdef CONFIG_SMP_ON_UP
  210.     .init.smpalt : {
  211.         __smpalt_begin = .;
  212. -       *(.alt.smp.init)
  213. +       KEEP(*(.alt.smp.init))
  214.         __smpalt_end = .;
  215.     }
  216.  #endif
  217.     .init.pv_table : {
  218.         __pv_table_begin = .;
  219. -       *(.pv_table)
  220. +       KEEP(*(.pv_table))
  221.         __pv_table_end = .;
  222.     }
  223.     .init.data : {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement