OSDN Git Service

kbuild: Allow LD_DEAD_CODE_DATA_ELIMINATION to be selectable if enabled
authorNicholas Piggin <npiggin@gmail.com>
Wed, 9 May 2018 13:00:00 +0000 (23:00 +1000)
committer0ranko0P <ranko0p@outlook.com>
Sat, 7 Dec 2019 08:37:13 +0000 (16:37 +0800)
Architectures that are capable can select
HAVE_LD_DEAD_CODE_DATA_ELIMINATION to enable selection of that
option (as an EXPERT kernel option).

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
arch/Kconfig
init/Kconfig

index 4398be3..a29c609 100644 (file)
@@ -423,21 +423,6 @@ config CC_STACKPROTECTOR_STRONG
 
 endchoice
 
-config LD_DEAD_CODE_DATA_ELIMINATION
-       bool
-       help
-         Select this if the architecture wants to do dead code and
-         data elimination with the linker by compiling with
-         -ffunction-sections -fdata-sections and linking with
-         --gc-sections.
-
-         This requires that the arch annotates or otherwise protects
-         its external entry points from being discarded. Linker scripts
-         must also merge .text.*, .data.*, and .bss.* correctly into
-         output sections. Care must be taken not to pull in unrelated
-         sections (e.g., '.text.init'). Typically '.' in section names
-         is used to distinguish them from label names / C identifiers.
-
 config HAVE_ARCH_WITHIN_STACK_FRAMES
        bool
        help
index d0e8c01..cbb41a9 100644 (file)
@@ -1458,6 +1458,33 @@ config CC_OPTIMIZE_FOR_SIZE
 
 endchoice
 
+config HAVE_LD_DEAD_CODE_DATA_ELIMINATION
+       bool
+       help
+         This requires that the arch annotates or otherwise protects
+         its external entry points from being discarded. Linker scripts
+         must also merge .text.*, .data.*, and .bss.* correctly into
+         output sections. Care must be taken not to pull in unrelated
+         sections (e.g., '.text.init'). Typically '.' in section names
+         is used to distinguish them from label names / C identifiers.
+
+config LD_DEAD_CODE_DATA_ELIMINATION
+       bool "Dead code and data elimination (EXPERIMENTAL)"
+       depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION
+       depends on EXPERT
+       help
+         Select this if the architecture wants to do dead code and
+         data elimination with the linker by compiling with
+         -ffunction-sections -fdata-sections, and linking with
+         --gc-sections.
+
+         This can reduce on disk and in-memory size of the kernel
+         code and static data, particularly for small configs and
+         on small systems. This has the possibility of introducing
+         silently broken kernel if the required annotations are not
+         present. This option is not well tested yet, so use at your
+         own risk.
+
 config SYSCTL
        bool