Skip to content

Commit

Permalink
kbuild: LD_DEAD_CODE_DATA_ELIMINATION no -ffunction-sections/-fdata-s…
Browse files Browse the repository at this point in the history
…ections for module build

Modules do not tend to cope with -ffunction-sections, even though they
do not link with -gc-sections. It may be possible for unused symbols to
be trimmed from modules, but in general that would take much more work
in architecture module linker scripts.

For now, enable these only for kernel build.

Signed-off-by: Nicholas Piggin <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
npiggin authored and masahir0y committed May 17, 2018
1 parent 266ff2a commit 6ca8d94
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,8 @@ 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 += $(call cc-option,-ffunction-sections,)
KBUILD_CFLAGS_KERNEL += $(call cc-option,-fdata-sections,)
endif

# arch Makefile may override CC so keep this after arch Makefile is included
Expand Down

0 comments on commit 6ca8d94

Please sign in to comment.