Commit 1ceee1b7 authored by Denis Vlasenko's avatar Denis Vlasenko Committed by Sam Ravnborg

kbuild: make gcc -align options .config-settable

With all alignment options set to 1 (minimum alignment),
I've got 5% smaller vmlinux compared to one built with
default code alignment.
Original implementation altered to use cc-option-align by sam.

From: Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 78a14efa
......@@ -503,6 +503,13 @@ else
CFLAGS += -O2
endif
#Add align options if CONFIG_CC_* is not equal to 0
add-align = $(if $(filter-out 0,$($(1))),$(cc-option-align)$(2)=$($(1)))
CFLAGS += $(call add-align,CONFIG_CC_ALIGN_FUNCTIONS,-functions)
CFLAGS += $(call add-align,CONFIG_CC_ALIGN_LABELS,-labels)
CFLAGS += $(call add-align,CONFIG_CC_ALIGN_LOOPS,-loops)
CFLAGS += $(call add-align,CONFIG_CC_ALIGN_JUMPS,-jumps)
ifdef CONFIG_FRAME_POINTER
CFLAGS += -fno-omit-frame-pointer
else
......
......@@ -303,6 +303,43 @@ config SHMEM
option replaces shmem and tmpfs with the much simpler ramfs code,
which may be appropriate on small systems without swap.
config CC_ALIGN_FUNCTIONS
int "Function alignment"
default 0
help
Align the start of functions to the next power-of-two greater than n,
skipping up to n bytes. For instance, 32 aligns functions
to the next 32-byte boundary, but 24 would align to the next
32-byte boundary only if this can be done by skipping 23 bytes or less.
Zero means use compiler's default.
config CC_ALIGN_LABELS
int "Label alignment"
default 0
help
Align all branch targets to a power-of-two boundary, skipping
up to n bytes like ALIGN_FUNCTIONS. This option can easily
make code slower, because it must insert dummy operations for
when the branch target is reached in the usual flow of the code.
Zero means use compiler's default.
config CC_ALIGN_LOOPS
int "Loop alignment"
default 0
help
Align loops to a power-of-two boundary, skipping up to n bytes.
Zero means use compiler's default.
config CC_ALIGN_JUMPS
int "Jump alignment"
default 0
help
Align branch targets to a power-of-two boundary, for branch
targets where the targets can only be reached by jumping,
skipping up to n bytes like ALIGN_FUNCTIONS. In this case,
no dummy operations need be executed.
Zero means use compiler's default.
endmenu # General setup
config TINY_SHMEM
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment