Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 204825
b: refs/heads/master
c: 6588169
h: refs/heads/master
i:
  204823: e880ea9
v: v3
  • Loading branch information
Sam Ravnborg authored and Michal Marek committed Aug 3, 2010
1 parent cc065f0 commit 599c5d3
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d6f4ceb796ebf1a8c8a9ad4a8ea0d181aaec7de6
refs/heads/master: 6588169d516560f68672e2928680b71c647b7806
16 changes: 14 additions & 2 deletions trunk/Documentation/kbuild/kbuild.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,23 @@ building C files and assembler files.

KAFLAGS
--------------------------------------------------
Additional options to the assembler.
Additional options to the assembler (for built-in and modules).

AFLAGS_MODULE
--------------------------------------------------
Addtional module specific options to use for $(AS).

KCFLAGS
--------------------------------------------------
Additional options to the C compiler.
Additional options to the C compiler (for built-in and modules).

CFLAGS_MODULE
--------------------------------------------------
Addtional module specific options to use for $(CC).

LDFLAGS_MODULE
--------------------------------------------------
Additional options used for $(LD) when linking modules.

KBUILD_VERBOSE
--------------------------------------------------
Expand Down
18 changes: 15 additions & 3 deletions trunk/Documentation/kbuild/makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -928,11 +928,23 @@ When kbuild executes, the following steps are followed (roughly):
$(CFLAGS_KERNEL) contains extra C compiler flags used to compile
resident kernel code.

CFLAGS_MODULE $(CC) options specific for modules
KBUILD_AFLAGS_MODULE Options for $(AS) when building modules

$(CFLAGS_MODULE) contains extra C compiler flags used to compile code
for loadable kernel modules.
$(KBUILD_AFLAGS_MODULE) is used to add arch specific options that
are used for $(AS).
From commandline AFLAGS_MODULE shall be used (see kbuild.txt).

KBUILD_CFLAGS_MODULE Options for $(CC) when building modules

$(KBUILD_CFLAGS_MODULE) is used to add arch specific options that
are used for $(CC).
From commandline CFLAGS_MODULE shall be used (see kbuild.txt).

KBUILD_LDFLAGS_MODULE Options for $(LD) when linking modules

$(KBUILD_LDFLAGS_MODULE) is used to add arch specific options
used when linking modules. This is often a linker script.
From commandline LDFLAGS_MODULE shall be used (see kbuild.txt).

--- 6.2 Add prerequisites to archprepare:

Expand Down
13 changes: 8 additions & 5 deletions trunk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,9 @@ CHECK = sparse

CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-Wbitwise -Wno-return-void $(CF)
MODFLAGS = -DMODULE
CFLAGS_MODULE = $(MODFLAGS)
AFLAGS_MODULE = $(MODFLAGS)
LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds
CFLAGS_MODULE =
AFLAGS_MODULE =
LDFLAGS_MODULE =
CFLAGS_KERNEL =
AFLAGS_KERNEL =
CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
Expand All @@ -355,6 +354,9 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-Wno-format-security \
-fno-delete-null-pointer-checks
KBUILD_AFLAGS := -D__ASSEMBLY__
KBUILD_AFLAGS_MODULE := -DMODULE
KBUILD_CFLAGS_MODULE := -DMODULE
KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds

# Read KERNELRELEASE from include/config/kernel.release (if it exists)
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
Expand All @@ -369,6 +371,7 @@ export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE

# When compiling out-of-tree modules, put MODVERDIR in the module
# tree rather than in the kernel tree. The kernel tree might
Expand Down Expand Up @@ -607,7 +610,7 @@ endif
# Use --build-id when available.
LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
$(call cc-ldoption, -Wl$(comma)--build-id,))
LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)

ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/avr32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ KBUILD_DEFCONFIG := atstk1002_defconfig

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

cpuflags-$(CONFIG_PLATFORM_AT32AP) += -march=ap
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/blackfin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ GZFLAGS := -9

KBUILD_CFLAGS += $(call cc-option,-mno-fdpic)
KBUILD_AFLAGS += $(call cc-option,-mno-fdpic)
CFLAGS_MODULE += -mlong-calls
LDFLAGS_MODULE += -m elf32bfin
KBUILD_CFLAGS_MODULE += -mlong-calls
KBUILD_LDFLAGS_MODULE += -m elf32bfin
KALLSYMS += --symbol-prefix=_

KBUILD_DEFCONFIG := BF537-STAMP_defconfig
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/ia64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CHECKFLAGS += -m64 -D__ia64=1 -D__ia64__=1 -D_LP64 -D__LP64__

OBJCOPYFLAGS := --strip-all
LDFLAGS_vmlinux := -static
LDFLAGS_MODULE += -T $(srctree)/arch/ia64/module.lds
KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/ia64/module.lds
AFLAGS_KERNEL := -mconstant-gp
EXTRA :=

Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/m32r/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ LDFLAGS_vmlinux :=

KBUILD_CFLAGS += -pipe -fno-schedule-insns
CFLAGS_KERNEL += -mmodel=medium
CFLAGS_MODULE += -mmodel=large
KBUILD_CFLAGS_MODULE += -mmodel=large

ifdef CONFIG_CHIP_VDEC2
cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/m68k/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ KBUILD_DEFCONFIG := multi_defconfig
# override top level makefile
AS += -m68020
LDFLAGS := -m m68kelf
LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
ifneq ($(SUBARCH),$(ARCH))
ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := $(call cc-cross-prefix, \
Expand Down
6 changes: 4 additions & 2 deletions trunk/arch/mips/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz
cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
cflags-y += -msoft-float
LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
MODFLAGS += -mlong-calls
KBUILD_AFLAGS_MODULE += -mlong-calls
KBUILD_CFLAGS_MODULE += -mlong-calls

cflags-y += -ffreestanding

Expand Down Expand Up @@ -172,7 +173,8 @@ cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS) += $(call cc-option,-mno-daddi,)

ifdef CONFIG_CPU_SB1
ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
MODFLAGS += -msb1-pass1-workarounds
KBUILD_AFLAGS_MODULE += -msb1-pass1-workarounds
KBUILD_CFLAGS_MODULE += -msb1-pass1-workarounds
endif
endif

Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/powerpc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ else
KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
endif
else
LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
endif

ifeq ($(CONFIG_TUNE_CELL),y)
Expand Down
3 changes: 2 additions & 1 deletion trunk/arch/s390/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ STACK_SIZE := 8192
CHECKFLAGS += -D__s390__ -msize-long
else
LDFLAGS := -m elf64_s390
MODFLAGS += -fpic -D__PIC__
KBUILD_AFLAGS_MODULE += -fpic -D__PIC__
KBUILD_CFLAGS_MODULE += -fpic -D__PIC__
KBUILD_CFLAGS += -m64
KBUILD_AFLAGS += -m64
UTS_MACHINE := s390x
Expand Down
3 changes: 2 additions & 1 deletion trunk/arch/score/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ cflags-y += -G0 -pipe -mel -mnhwloop -D__SCOREEL__ \
#
KBUILD_AFLAGS += $(cflags-y)
KBUILD_CFLAGS += $(cflags-y)
MODFLAGS += -mlong-calls
KBUILD_AFLAGS_MODULE += -mlong-calls
KBUILD_CFLAGS_MODULE += -mlong-calls
LDFLAGS += --oformat elf32-littlescore
LDFLAGS_vmlinux += -G0 -static -nostdlib

Expand Down
9 changes: 6 additions & 3 deletions trunk/scripts/Makefile.build
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ endif
# ---------------------------------------------------------------------------

# Default is built-in, unless we know otherwise
modkern_cflags = $(if $(part-of-module), $(CFLAGS_MODULE), $(CFLAGS_KERNEL))
modkern_cflags = \
$(if $(part-of-module), \
$(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \
$(CFLAGS_KERNEL))
quiet_modtag := $(empty) $(empty)

$(real-objs-m) : part-of-module := y
Expand Down Expand Up @@ -250,8 +253,8 @@ $(obj)/%.lst: $(src)/%.c FORCE

modkern_aflags := $(AFLAGS_KERNEL)

$(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE)
$(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE)
$(real-objs-m) : modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)
$(real-objs-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE)

quiet_cmd_as_s_S = CPP $(quiet_modtag) $@
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
Expand Down
7 changes: 4 additions & 3 deletions trunk/scripts/Makefile.modpost
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ $(modules:.ko=.mod.c): __modpost ;
modname = $(notdir $(@:.mod.o=))

quiet_cmd_cc_o_c = CC $@
cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \
cmd_cc_o_c = $(CC) $(c_flags) $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE) \
-c -o $@ $<

$(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE
Expand All @@ -117,8 +117,9 @@ targets += $(modules:.ko=.mod.o)

# Step 6), final link of the modules
quiet_cmd_ld_ko_o = LD [M] $@
cmd_ld_ko_o = $(LD) -r $(LDFLAGS) $(LDFLAGS_MODULE) -o $@ \
$(filter-out FORCE,$^)
cmd_ld_ko_o = $(LD) -r $(LDFLAGS) \
$(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
-o $@ $(filter-out FORCE,$^)

$(modules): %.ko :%.o %.mod.o FORCE
$(call if_changed,ld_ko_o)
Expand Down

0 comments on commit 599c5d3

Please sign in to comment.