Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 222d394d authored by Sam Ravnborg's avatar Sam Ravnborg
Browse files

kbuild: enable 'make AFLAGS=...' to add additional options to AS



The variable AFLAGS is a wellknown variable and the usage by
kbuild may result in unexpected behaviour.
On top of that several people over time has asked for a way to
pass in additional flags to gcc.

This patch replace use of AFLAGS with KBUILD_AFLAGS all over
the tree.

Patch was tested on following architectures:
alpha, arm, i386, x86_64, mips, sparc, sparc64, ia64, m68k, s390

Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 714055ed
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -424,6 +424,7 @@ more details, with real examples.
	as-instr checks if the assembler reports a specific instruction
	and then outputs either option1 or option2
	C escapes are supported in the test instruction
	Note: as-instr-option uses KBUILD_AFLAGS for $(AS) options

    cc-option
	cc-option is used to check if $(CC) supports a given option, and not
@@ -819,14 +820,14 @@ When kbuild executes, the following steps are followed (roughly):
	In this example, the binary $(obj)/image is a binary version of
	vmlinux. The usage of $(call if_changed,xxx) will be described later.

    AFLAGS		$(AS) assembler flags
    KBUILD_AFLAGS		$(AS) assembler flags

	Default value - see top level Makefile
	Append or modify as required per architecture.

	Example:
		#arch/sparc64/Makefile
		AFLAGS += -m64 -mcpu=ultrasparc
		KBUILD_AFLAGS += -m64 -mcpu=ultrasparc

    KBUILD_CFLAGS		$(CC) compiler flags

+4 −4
Original line number Diff line number Diff line
@@ -323,7 +323,7 @@ CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
		   -fno-strict-aliasing -fno-common \
		   -Werror-implicit-function-declaration
AFLAGS          := -D__ASSEMBLY__
KBUILD_AFLAGS   := -D__ASSEMBLY__

# Read KERNELRELEASE from include/config/kernel.release (if it exists)
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
@@ -336,7 +336,7 @@ export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS

export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE

# When compiling out-of-tree modules, put MODVERDIR in the module
# tree rather than in the kernel tree. The kernel tree might
@@ -507,7 +507,7 @@ endif

ifdef CONFIG_DEBUG_INFO
KBUILD_CFLAGS	+= -g
AFLAGS		+= -gdwarf-2
KBUILD_AFLAGS	+= -gdwarf-2
endif

# Force gcc to behave correct even for buggy distributions
@@ -1502,7 +1502,7 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))
      cmd_rmfiles = rm -f $(rm-files)


a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \
a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
	  $(NOSTDINC_FLAGS) $(CPPFLAGS) \
	  $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o)

+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ endif

# Need -Uarm for gcc < 3.x
KBUILD_CFLAGS	+=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
AFLAGS		+=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float
KBUILD_AFLAGS	+=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float

CHECKFLAGS	+= -D__arm__

+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
# EXTRA_CFLAGS := -DDEBUG
# EXTRA_AFLAGS := -DDEBUG

AFLAGS		:=$(AFLAGS:-msoft-float=-Wa,-mfpu=softvfp+vfp)
KBUILD_AFLAGS	:=$(KBUILD_AFLAGS:-msoft-float=-Wa,-mfpu=softvfp+vfp)
LDFLAGS		+=--no-warn-mismatch

obj-y			+= vfp.o
+2 −2
Original line number Diff line number Diff line
@@ -12,14 +12,14 @@ all: uImage vmlinux.elf
KBUILD_DEFCONFIG	:= atstk1002_defconfig

KBUILD_CFLAGS	+= -pipe -fno-builtin -mno-pic
AFLAGS		+= -mrelax -mno-pic
KBUILD_AFLAGS	+= -mrelax -mno-pic
CFLAGS_MODULE	+= -mno-relax
LDFLAGS_vmlinux	+= --relax

cpuflags-$(CONFIG_CPU_AT32AP7000)	+= -mcpu=ap7000

KBUILD_CFLAGS	+= $(cpuflags-y)
AFLAGS		+= $(cpuflags-y)
KBUILD_AFLAGS	+= $(cpuflags-y)

CHECKFLAGS	+= -D__avr32__ -D__BIG_ENDIAN

Loading