* [PATCH 1/3] kbuild: allow user to assign {A,C}FLAGS_MODULE
2010-07-26 20:38 [PATCH 0/3] update of various kbuild flags to allow user settings Sam Ravnborg
@ 2010-07-26 20:42 ` Sam Ravnborg
2010-07-26 20:43 ` [PATCH 2/3] frv: remove useless ARCHMODFLAGS assignment Sam Ravnborg
2010-07-26 20:44 ` [PATCH 3/3] kbuild: allow user to assign LDFLAGS_MODULE Sam Ravnborg
2 siblings, 0 replies; 9+ messages in thread
From: Sam Ravnborg @ 2010-07-26 20:42 UTC (permalink / raw)
To: Michal Marek, linux-kbuild, lkml, Denys Vlasenko
Cc: Ralf Baechle, Martin Schwidefsky, Chen Liqin
>From 7ae2b4f270b0a6273072d73bbfeaa96815cc24af Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Mon, 26 Jul 2010 21:03:08 +0200
Subject: [PATCH 1/3] kbuild: allow user to assign {A,C}FLAGS_MODULE
Do not use {A,C}FLAGS_MODULE in the top-level Makefile.
So if user assign a value to one of these variables we the
original value is not lost.
Use a kbuild internal variable that archs can use.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Chen Liqin <liqin.chen@sunplusct.com>
---
Makefile | 8 ++++----
arch/mips/Makefile | 4 ++--
arch/s390/Makefile | 2 +-
arch/score/Makefile | 2 +-
scripts/Makefile.build | 9 ++++++---
5 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/Makefile b/Makefile
index a14c207..5e72848 100644
--- a/Makefile
+++ b/Makefile
@@ -332,9 +332,8 @@ CHECK = sparse
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-Wbitwise -Wno-return-void $(CF)
-MODFLAGS = -DMODULE
-CFLAGS_MODULE = $(MODFLAGS)
-AFLAGS_MODULE = $(MODFLAGS)
+CFLAGS_MODULE =
+AFLAGS_MODULE =
LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds
CFLAGS_KERNEL =
AFLAGS_KERNEL =
@@ -355,6 +354,7 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-Wno-format-security \
-fno-delete-null-pointer-checks
KBUILD_AFLAGS := -D__ASSEMBLY__
+KBUILD_MODFLAGS := -DMODULE
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
@@ -368,7 +368,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 AFLAGS_KERNEL AFLAGS_MODULE KBUILD_MODFLAGS
# When compiling out-of-tree modules, put MODVERDIR in the module
# tree rather than in the kernel tree. The kernel tree might
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 0b9c01a..2d77a2d 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -93,7 +93,7 @@ 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_MODFLAGS += -mlong-calls
cflags-y += -ffreestanding
@@ -185,7 +185,7 @@ 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_MODFLAGS += -msb1-pass1-workarounds
endif
endif
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 30c5f01..16a3ef9 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -24,7 +24,7 @@ CHECKFLAGS += -D__s390__ -msize-long
else
LD_BFD := elf64-s390
LDFLAGS := -m elf64_s390
-MODFLAGS += -fpic -D__PIC__
+KBUILD_MODFLAGS += -fpic -D__PIC__
KBUILD_CFLAGS += -m64
KBUILD_AFLAGS += -m64
UTS_MACHINE := s390x
diff --git a/arch/score/Makefile b/arch/score/Makefile
index 68e0cd0..c667f1d 100644
--- a/arch/score/Makefile
+++ b/arch/score/Makefile
@@ -20,7 +20,7 @@ cflags-y += -G0 -pipe -mel -mnhwloop -D__SCOREEL__ \
#
KBUILD_AFLAGS += $(cflags-y)
KBUILD_CFLAGS += $(cflags-y)
-MODFLAGS += -mlong-calls
+KBUILD_MODFLAGS += -mlong-calls
LDFLAGS += --oformat elf32-littlescore
LDFLAGS_vmlinux += -G0 -static -nostdlib
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 390aae4..2818802 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -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_MODFLAGS) $(CFLAGS_MODULE), \
+ $(CFLAGS_KERNEL))
quiet_modtag := $(empty) $(empty)
$(real-objs-m) : part-of-module := y
@@ -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_MODFLAGS) $(AFLAGS_MODULE)
+$(real-objs-m:.o=.s): modkern_aflags := $(KBUILD_MODFLAGS) $(AFLAGS_MODULE)
quiet_cmd_as_s_S = CPP $(quiet_modtag) $@
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
--
1.6.0.6
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/3] frv: remove useless ARCHMODFLAGS assignment
2010-07-26 20:38 [PATCH 0/3] update of various kbuild flags to allow user settings Sam Ravnborg
2010-07-26 20:42 ` [PATCH 1/3] kbuild: allow user to assign {A,C}FLAGS_MODULE Sam Ravnborg
@ 2010-07-26 20:43 ` Sam Ravnborg
2010-07-27 9:00 ` David Howells
2010-07-26 20:44 ` [PATCH 3/3] kbuild: allow user to assign LDFLAGS_MODULE Sam Ravnborg
2 siblings, 1 reply; 9+ messages in thread
From: Sam Ravnborg @ 2010-07-26 20:43 UTC (permalink / raw)
To: Michal Marek, linux-kbuild, lkml; +Cc: David Howells
>From e72470f99bad5a3d1632e738cdf884bfc2d8687f Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Mon, 26 Jul 2010 22:11:36 +0200
Subject: [PATCH 2/3] frv: remove useless ARCHMODFLAGS assignment
There is no references to ARCHMODLFAGS throughout the kernel tree.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: David Howells <dhowells@redhat.com>
---
arch/frv/Makefile | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/arch/frv/Makefile b/arch/frv/Makefile
index 310c47a..018455e 100644
--- a/arch/frv/Makefile
+++ b/arch/frv/Makefile
@@ -36,8 +36,6 @@ else
UTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\"
endif
-ARCHMODFLAGS += -G0 -mlong-calls
-
ifdef CONFIG_GPREL_DATA_8
KBUILD_CFLAGS += -G8
else
--
1.6.0.6
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 2/3] frv: remove useless ARCHMODFLAGS assignment
2010-07-26 20:43 ` [PATCH 2/3] frv: remove useless ARCHMODFLAGS assignment Sam Ravnborg
@ 2010-07-27 9:00 ` David Howells
2010-07-27 9:13 ` Sam Ravnborg
0 siblings, 1 reply; 9+ messages in thread
From: David Howells @ 2010-07-27 9:00 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: dhowells, Michal Marek, linux-kbuild, lkml
Sam Ravnborg <sam@ravnborg.org> wrote:
> There is no references to ARCHMODLFAGS throughout the kernel tree.
Ummm... Okay. I guess modules don't work on FRV then.
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: David Howells <dhowells@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] frv: remove useless ARCHMODFLAGS assignment
2010-07-27 9:00 ` David Howells
@ 2010-07-27 9:13 ` Sam Ravnborg
2010-07-27 9:15 ` David Howells
0 siblings, 1 reply; 9+ messages in thread
From: Sam Ravnborg @ 2010-07-27 9:13 UTC (permalink / raw)
To: David Howells; +Cc: Michal Marek, linux-kbuild, lkml
On Tue, Jul 27, 2010 at 10:00:25AM +0100, David Howells wrote:
> Sam Ravnborg <sam@ravnborg.org> wrote:
>
> > There is no references to ARCHMODLFAGS throughout the kernel tree.
>
> Ummm... Okay. I guess modules don't work on FRV then.
We could change it to:
-ARCHMODFLAGS += -G0 -mlong-calls
+KBUILD_MODFLAGS += -G0 -mlong-calls
Would this be better?
Sam
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] kbuild: allow user to assign LDFLAGS_MODULE
2010-07-26 20:38 [PATCH 0/3] update of various kbuild flags to allow user settings Sam Ravnborg
2010-07-26 20:42 ` [PATCH 1/3] kbuild: allow user to assign {A,C}FLAGS_MODULE Sam Ravnborg
2010-07-26 20:43 ` [PATCH 2/3] frv: remove useless ARCHMODFLAGS assignment Sam Ravnborg
@ 2010-07-26 20:44 ` Sam Ravnborg
2010-07-26 20:54 ` Mike Frysinger
2 siblings, 1 reply; 9+ messages in thread
From: Sam Ravnborg @ 2010-07-26 20:44 UTC (permalink / raw)
To: Michal Marek, linux-kbuild, lkml
Cc: Mike Frysinger, Tony Luck, Geert Uytterhoeven,
Benjamin Herrenschmidt
>From ce765a28adeb8878413a49ce62f442022d6a5b6a Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Mon, 26 Jul 2010 22:20:12 +0200
Subject: [PATCH 3/3] kbuild: allow user to assign LDFLAGS_MODULE
Do not use LDFLAGS_MODULE in the top-level Makefile.
So if user assign a value to LDFALGS_MODULE the
original value is not lost.
Use a kbuild internal variable that archs can use,
and update all archs that used LDFALGS_MODULE.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
Makefile | 8 +++++---
arch/blackfin/Makefile | 2 +-
arch/ia64/Makefile | 2 +-
arch/m68k/Makefile | 2 +-
arch/powerpc/Makefile | 2 +-
scripts/Makefile.modpost | 5 +++--
6 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
index 5e72848..08d3bf0 100644
--- a/Makefile
+++ b/Makefile
@@ -334,7 +334,7 @@ CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-Wbitwise -Wno-return-void $(CF)
CFLAGS_MODULE =
AFLAGS_MODULE =
-LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds
+LDFLAGS_MODULE =
CFLAGS_KERNEL =
AFLAGS_KERNEL =
CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
@@ -355,6 +355,7 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-delete-null-pointer-checks
KBUILD_AFLAGS := -D__ASSEMBLY__
KBUILD_MODFLAGS := -DMODULE
+KBUILD_LDMODFLAGS := -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)
@@ -368,7 +369,8 @@ 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 KBUILD_MODFLAGS
+export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
+export KBUILD_MODFLAGS KBUILD_LDMODFLAGS
# When compiling out-of-tree modules, put MODVERDIR in the module
# tree rather than in the kernel tree. The kernel tree might
@@ -607,7 +609,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_LDMODFLAGS += $(LDFLAGS_BUILD_ID)
LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index 5a97a31..df1e1df 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -19,7 +19,7 @@ KBUILD_CFLAGS += -mlong-calls
endif
KBUILD_AFLAGS += $(call cc-option,-mno-fdpic)
CFLAGS_MODULE += -mlong-calls
-LDFLAGS_MODULE += -m elf32bfin
+KBUILD_LDMODFLAGS += -m elf32bfin
KALLSYMS += --symbol-prefix=_
KBUILD_DEFCONFIG := BF537-STAMP_defconfig
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile
index 8ae0d26..072d4f0 100644
--- a/arch/ia64/Makefile
+++ b/arch/ia64/Makefile
@@ -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_LDMODFLAGS += -T $(srctree)/arch/ia64/module.lds
AFLAGS_KERNEL := -mconstant-gp
EXTRA :=
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 570d85c..58187f2 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -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_LDMODFLAGS += -T $(srctree)/arch/m68k/kernel/module.lds
ifneq ($(SUBARCH),$(ARCH))
ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := $(call cc-cross-prefix, \
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 77cfe7a..a01448b 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -94,7 +94,7 @@ else
endif
endif
-LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
+KBUILD_LDMODFLAGS += arch/powerpc/lib/crtsavres.o
ifeq ($(CONFIG_TUNE_CELL),y)
KBUILD_CFLAGS += $(call cc-option,-mtune=cell)
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 8f14c81..1948f7a 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -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_LDMODFLAGS) $(LDFLAGS_MODULE) \
+ -o $@ $(filter-out FORCE,$^)
$(modules): %.ko :%.o %.mod.o FORCE
$(call if_changed,ld_ko_o)
--
1.6.0.6
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 3/3] kbuild: allow user to assign LDFLAGS_MODULE
2010-07-26 20:44 ` [PATCH 3/3] kbuild: allow user to assign LDFLAGS_MODULE Sam Ravnborg
@ 2010-07-26 20:54 ` Mike Frysinger
2010-07-26 21:48 ` Sam Ravnborg
0 siblings, 1 reply; 9+ messages in thread
From: Mike Frysinger @ 2010-07-26 20:54 UTC (permalink / raw)
To: Sam Ravnborg
Cc: Michal Marek, linux-kbuild, lkml, Tony Luck, Geert Uytterhoeven,
Benjamin Herrenschmidt
On Mon, Jul 26, 2010 at 16:44, Sam Ravnborg wrote:
> From ce765a28adeb8878413a49ce62f442022d6a5b6a Mon Sep 17 00:00:00 2001
> From: Sam Ravnborg <sam@ravnborg.org>
> Date: Mon, 26 Jul 2010 22:20:12 +0200
> Subject: [PATCH 3/3] kbuild: allow user to assign LDFLAGS_MODULE
>
> Do not use LDFLAGS_MODULE in the top-level Makefile.
> So if user assign a value to LDFALGS_MODULE the
> original value is not lost.
>
> Use a kbuild internal variable that archs can use,
> and update all archs that used LDFALGS_MODULE.
assuming end behavior is the same, the Blackfin part is:
Acked-by: Mike Frysinger <vapier@gentoo.org>
also, could you say the same thing for CFLAGS_MODULE ?
-mike
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] kbuild: allow user to assign LDFLAGS_MODULE
2010-07-26 20:54 ` Mike Frysinger
@ 2010-07-26 21:48 ` Sam Ravnborg
0 siblings, 0 replies; 9+ messages in thread
From: Sam Ravnborg @ 2010-07-26 21:48 UTC (permalink / raw)
To: Mike Frysinger
Cc: Michal Marek, linux-kbuild, lkml, Tony Luck, Geert Uytterhoeven,
Benjamin Herrenschmidt
On Mon, Jul 26, 2010 at 04:54:05PM -0400, Mike Frysinger wrote:
> On Mon, Jul 26, 2010 at 16:44, Sam Ravnborg wrote:
> > From ce765a28adeb8878413a49ce62f442022d6a5b6a Mon Sep 17 00:00:00 2001
> > From: Sam Ravnborg <sam@ravnborg.org>
> > Date: Mon, 26 Jul 2010 22:20:12 +0200
> > Subject: [PATCH 3/3] kbuild: allow user to assign LDFLAGS_MODULE
> >
> > Do not use LDFLAGS_MODULE in the top-level Makefile.
> > So if user assign a value to LDFALGS_MODULE the
> > original value is not lost.
> >
> > Use a kbuild internal variable that archs can use,
> > and update all archs that used LDFALGS_MODULE.
>
> assuming end behavior is the same, the Blackfin part is:
> Acked-by: Mike Frysinger <vapier@gentoo.org>
It is :-)
>
> also, could you say the same thing for CFLAGS_MODULE ?
Good point. Need to do the same here.
I also realised I need to update Documentation/kbuild/makefiles.txt
Michal - I will send an updated serie tomorrow.
Sam
^ permalink raw reply [flat|nested] 9+ messages in thread