Commit 78a14efa authored by Sam Ravnborg's avatar Sam Ravnborg

kbuild: Add cc-option-align

gcc version >= 3.00 shifted from -malign-* to -falign-*. $(cc-option-align) will
based on current gcc version specify the right prefix for the align option.
Documented in Documentation/makefiles.txt
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent bd7829ab
......@@ -997,6 +997,21 @@ When kbuild executes the following steps are followed (roughly):
option. When $(biarch) equals to y the expanded variables $(aflags-y)
and $(cflags-y) will be assigned the values -a32 and -m32.
cc-option-align
gcc version >= 3.0 shifted type of options used to speify
alignment of functions, loops etc. $(cc-option-align) whrn used
as prefix to the align options will select the right prefix:
gcc < 3.00
cc-option-align = -malign
gcc >= 3.00
cc-option-align = -falign
Example:
CFLAGS += $(cc-option-align)-functions=4
In the above example the option -falign-functions=4 is used for
gcc >= 3.00. For gcc < 3.00 -malign-functions=4 is used.
cc-version
cc-version return a numerical version of the $(CC) compiler version.
The format is <major><minor> where both are two digits. So for example
......
......@@ -295,6 +295,11 @@ check_gcc = $(warning check_gcc is deprecated - use cc-option) \
cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
> /dev/null 2>&1; then echo "y"; else echo "n"; fi;)
# cc-option-align
# Prefix align with either -falign or -malign
cc-option-align = $(subst -functions=0,,\
$(call cc-option,-falign-functions=0,-malign-functions=0))
# cc-version
# Usage gcc-ver := $(call cc-version $(CC))
cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \
......
......@@ -25,7 +25,7 @@ CFLAGS += -pipe -msoft-float
# prevent gcc from keeping the stack 16 byte aligned
CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2)
align := $(subst -functions=0,,$(call cc-option,-falign-functions=0,-malign-functions=0))
align := $(cc-option-align)
cflags-$(CONFIG_M386) += -march=i386
cflags-$(CONFIG_M486) += -march=i486
cflags-$(CONFIG_M586) += -march=i586
......
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