linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ARM, hexagon, c6x: build: fix usage of CFLAGS_MODULE, LDFLAGS_MODULE
@ 2017-10-09 14:35 Masahiro Yamada
  2017-10-09 14:35 ` [PATCH 1/3] ARM: add KBUILD_ prefix to " Masahiro Yamada
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Masahiro Yamada @ 2017-10-09 14:35 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, linux-c6x-dev, linux-hexagon, linux-kernel,
	Mark Salter, Aurelien Jacquiot, Richard Kuo, Russell King,
	linux-arm-kernel

CFLAGS_MODULE, AFLAGS_MODULE, and LDFLAGS_MODULE are supposed
to be set by users.

In-kernel Makefile must use KBUILD_ prefixed variables.

This is explained in Documentation/kbuild/{kbuild.txt, makefiles.txt}

Most of architectures follow the rule, but I found violations
in ARM, hexagone, and c6x.

Fix them.



Masahiro Yamada (3):
  ARM: add KBUILD_ prefix to CFLAGS_MODULE, LDFLAGS_MODULE
  hexagon: add KBUILD_ prefix to CFLAGS_MODULE, LDFLAGS_MODULE
  c6x: add KBUILD_ prefix to CFLAGS_MODULE

 arch/arm/Makefile     | 6 +++---
 arch/c6x/Makefile     | 2 +-
 arch/hexagon/Makefile | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] ARM: add KBUILD_ prefix to CFLAGS_MODULE, LDFLAGS_MODULE
  2017-10-09 14:35 [PATCH 0/3] ARM, hexagon, c6x: build: fix usage of CFLAGS_MODULE, LDFLAGS_MODULE Masahiro Yamada
@ 2017-10-09 14:35 ` Masahiro Yamada
  2017-10-09 15:06   ` Russell King - ARM Linux
  2017-10-09 14:35 ` [PATCH 2/3] hexagon: " Masahiro Yamada
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2017-10-09 14:35 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Russell King, linux-arm-kernel, linux-kernel

{CFLAGS,LDFLAGS}_MODULE are supposed to be set by users, not by
in-kernel makefiles.

Documentation/kbuild/makefiles.txt clearly explains the difference:

  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).

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/arm/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index cdb5b55..cafa4d4 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -16,11 +16,11 @@ LDFLAGS		:=
 LDFLAGS_vmlinux	:=-p --no-undefined -X --pic-veneer
 ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
 LDFLAGS_vmlinux	+= --be8
-LDFLAGS_MODULE	+= --be8
+KBUILD_LDFLAGS_MODULE	+= --be8
 endif
 
 ifeq ($(CONFIG_ARM_MODULE_PLTS),y)
-LDFLAGS_MODULE	+= -T $(srctree)/arch/arm/kernel/module.lds
+KBUILD_LDFLAGS_MODULE	+= -T $(srctree)/arch/arm/kernel/module.lds
 endif
 
 GZFLAGS		:=-9
@@ -120,7 +120,7 @@ CFLAGS_ISA	:=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
 AFLAGS_ISA	:=$(CFLAGS_ISA) -Wa$(comma)-mthumb
 # Work around buggy relocation from gas if requested:
 ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
-CFLAGS_MODULE	+=-fno-optimize-sibling-calls
+KBUILD_CFLAGS_MODULE	+=-fno-optimize-sibling-calls
 endif
 else
 CFLAGS_ISA	:=$(call cc-option,-marm,)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] hexagon: add KBUILD_ prefix to CFLAGS_MODULE, LDFLAGS_MODULE
  2017-10-09 14:35 [PATCH 0/3] ARM, hexagon, c6x: build: fix usage of CFLAGS_MODULE, LDFLAGS_MODULE Masahiro Yamada
  2017-10-09 14:35 ` [PATCH 1/3] ARM: add KBUILD_ prefix to " Masahiro Yamada
@ 2017-10-09 14:35 ` Masahiro Yamada
  2017-10-09 14:35 ` [PATCH 3/3] c6x: add KBUILD_ prefix to CFLAGS_MODULE Masahiro Yamada
  2017-10-15  7:47 ` [PATCH 0/3] ARM, hexagon, c6x: build: fix usage of CFLAGS_MODULE, LDFLAGS_MODULE Masahiro Yamada
  3 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2017-10-09 14:35 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Richard Kuo, linux-kernel, linux-hexagon

{CFLAGS,LDFLAGS}_MODULE are supposed to be set by users, not by
in-kernel makefiles.

Documentation/kbuild/makefiles.txt clearly explains the difference:

  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).

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/hexagon/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/hexagon/Makefile b/arch/hexagon/Makefile
index 207711a0..4f5c84c 100644
--- a/arch/hexagon/Makefile
+++ b/arch/hexagon/Makefile
@@ -11,9 +11,9 @@ KBUILD_CFLAGS += -fno-short-enums
 
 # Modules must use either long-calls, or use pic/plt.
 # Use long-calls for now, it's easier.  And faster.
-# CFLAGS_MODULE += -fPIC
-# LDFLAGS_MODULE += -shared
-CFLAGS_MODULE += -mlong-calls
+# KBUILD_CFLAGS_MODULE += -fPIC
+# KBUILD_LDFLAGS_MODULE += -shared
+KBUILD_CFLAGS_MODULE += -mlong-calls
 
 cflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
 aflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] c6x: add KBUILD_ prefix to CFLAGS_MODULE
  2017-10-09 14:35 [PATCH 0/3] ARM, hexagon, c6x: build: fix usage of CFLAGS_MODULE, LDFLAGS_MODULE Masahiro Yamada
  2017-10-09 14:35 ` [PATCH 1/3] ARM: add KBUILD_ prefix to " Masahiro Yamada
  2017-10-09 14:35 ` [PATCH 2/3] hexagon: " Masahiro Yamada
@ 2017-10-09 14:35 ` Masahiro Yamada
  2017-10-15  7:47 ` [PATCH 0/3] ARM, hexagon, c6x: build: fix usage of CFLAGS_MODULE, LDFLAGS_MODULE Masahiro Yamada
  3 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2017-10-09 14:35 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Mark Salter, linux-c6x-dev, Aurelien Jacquiot,
	linux-kernel

CFLAGS_MODULE is supposed to be set by users, not by in-kernel
makefiles.

Documentation/kbuild/makefiles.txt clearly explains the difference:

  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).

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/c6x/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/c6x/Makefile b/arch/c6x/Makefile
index 6b0be67..6f6096f 100644
--- a/arch/c6x/Makefile
+++ b/arch/c6x/Makefile
@@ -12,7 +12,7 @@ cflags-y += -mno-dsbt -msdata=none -D__linux__
 
 cflags-$(CONFIG_C6X_BIG_KERNEL) += -mlong-calls
 
-CFLAGS_MODULE   += -mlong-calls -mno-dsbt -msdata=none
+KBUILD_CFLAGS_MODULE   += -mlong-calls -mno-dsbt -msdata=none
 
 CHECKFLAGS      +=
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] ARM: add KBUILD_ prefix to CFLAGS_MODULE, LDFLAGS_MODULE
  2017-10-09 14:35 ` [PATCH 1/3] ARM: add KBUILD_ prefix to " Masahiro Yamada
@ 2017-10-09 15:06   ` Russell King - ARM Linux
  0 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2017-10-09 15:06 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, linux-arm-kernel, linux-kernel

On Mon, Oct 09, 2017 at 11:35:13PM +0900, Masahiro Yamada wrote:
> {CFLAGS,LDFLAGS}_MODULE are supposed to be set by users, not by
> in-kernel makefiles.
> 
> Documentation/kbuild/makefiles.txt clearly explains the difference:
> 
>   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).
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] ARM, hexagon, c6x: build: fix usage of CFLAGS_MODULE, LDFLAGS_MODULE
  2017-10-09 14:35 [PATCH 0/3] ARM, hexagon, c6x: build: fix usage of CFLAGS_MODULE, LDFLAGS_MODULE Masahiro Yamada
                   ` (2 preceding siblings ...)
  2017-10-09 14:35 ` [PATCH 3/3] c6x: add KBUILD_ prefix to CFLAGS_MODULE Masahiro Yamada
@ 2017-10-15  7:47 ` Masahiro Yamada
  3 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2017-10-15  7:47 UTC (permalink / raw)
  To: Linux Kbuild mailing list
  Cc: Masahiro Yamada, linux-c6x-dev, linux-hexagon,
	Linux Kernel Mailing List, Mark Salter, Aurelien Jacquiot,
	Richard Kuo, Russell King, linux-arm-kernel

2017-10-09 23:35 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> CFLAGS_MODULE, AFLAGS_MODULE, and LDFLAGS_MODULE are supposed
> to be set by users.
>
> In-kernel Makefile must use KBUILD_ prefixed variables.
>
> This is explained in Documentation/kbuild/{kbuild.txt, makefiles.txt}
>
> Most of architectures follow the rule, but I found violations
> in ARM, hexagone, and c6x.
>
> Fix them.
>
>
>
> Masahiro Yamada (3):
>   ARM: add KBUILD_ prefix to CFLAGS_MODULE, LDFLAGS_MODULE
>   hexagon: add KBUILD_ prefix to CFLAGS_MODULE, LDFLAGS_MODULE
>   c6x: add KBUILD_ prefix to CFLAGS_MODULE
>
>  arch/arm/Makefile     | 6 +++---
>  arch/c6x/Makefile     | 2 +-
>  arch/hexagon/Makefile | 6 +++---
>  3 files changed, 7 insertions(+), 7 deletions(-)
>

Series, applied to linux-kbuild/kbuild.



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-15  7:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-09 14:35 [PATCH 0/3] ARM, hexagon, c6x: build: fix usage of CFLAGS_MODULE, LDFLAGS_MODULE Masahiro Yamada
2017-10-09 14:35 ` [PATCH 1/3] ARM: add KBUILD_ prefix to " Masahiro Yamada
2017-10-09 15:06   ` Russell King - ARM Linux
2017-10-09 14:35 ` [PATCH 2/3] hexagon: " Masahiro Yamada
2017-10-09 14:35 ` [PATCH 3/3] c6x: add KBUILD_ prefix to CFLAGS_MODULE Masahiro Yamada
2017-10-15  7:47 ` [PATCH 0/3] ARM, hexagon, c6x: build: fix usage of CFLAGS_MODULE, LDFLAGS_MODULE Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).