linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] arm, arm64, microblaze: add endianness options to LDFLAGS instead of LD
@ 2018-07-03  1:21 Masahiro Yamada
  2018-07-03  1:21 ` [PATCH 1/3] ARM: add endianness option " Masahiro Yamada
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Masahiro Yamada @ 2018-07-03  1:21 UTC (permalink / raw)
  To: linux-arm-kernel


We are able to evaluate compiler / toolchain capability in the
Kconfig phase.
(If you do not know the background of this work, please read
 the commit log of 316d55d55f49eca442e4fd948f5fa92bab0c8312)

To achieve this, 'CC', 'LD', etc. must be passed to Kconfig.

arch/*/Makefile should not tweak such environment variables
depending on CONFIG options - this would cause circular dependency.
  - We want to pass $(LD) from Makefile to Kconfig
  - CONFIG_CPU_BIG_ENDIAN is defined by Kconfig, then given
    back to Makefile

Nicholas already fixed this issue for PowerPC in commit 1421dc6d48296a.

I need to fix arm, arm64, microblaze as well
before I start moving linker option tests to Kconfig from Makefile.

arch maintainers:
Please pick up a proper patch for your tree.



Masahiro Yamada (3):
  ARM: add endianness option to LDFLAGS instead of LD
  arm64: add endianness option to LDFLAGS instead of LD
  microblaze: add endianness options to LDFLAGS instead of LD

 arch/arm/Makefile        | 4 ++--
 arch/arm64/Makefile      | 6 ++----
 arch/microblaze/Makefile | 4 ++--
 3 files changed, 6 insertions(+), 8 deletions(-)

-- 
2.7.4

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

* [PATCH 1/3] ARM: add endianness option to LDFLAGS instead of LD
  2018-07-03  1:21 [PATCH 0/3] arm, arm64, microblaze: add endianness options to LDFLAGS instead of LD Masahiro Yamada
@ 2018-07-03  1:21 ` Masahiro Yamada
  2018-07-03  1:22 ` [PATCH 2/3] arm64: " Masahiro Yamada
  2018-07-03  1:22 ` [PATCH 3/3] microblaze: add endianness options " Masahiro Yamada
  2 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2018-07-03  1:21 UTC (permalink / raw)
  To: linux-arm-kernel

With the recent syntax extension, Kconfig is now able to evaluate the
compiler / toolchain capability.

However, accumulating flags to 'LD' is not compatible with the way
it works; 'LD' must be passed to Kconfig to call $(ld-option,...)
from Kconfig files.  If you tweak 'LD' in arch Makefile depending on
CONFIG_CPU_BIG_ENDIAN, this would end up with circular dependency
between Makefile and Kconfig.

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

 arch/arm/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index fc26c3d..62ebeae 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -46,12 +46,12 @@ ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
 KBUILD_CPPFLAGS	+= -mbig-endian
 CHECKFLAGS	+= -D__ARMEB__
 AS		+= -EB
-LD		+= -EB
+LDFLAGS		+= -EB
 else
 KBUILD_CPPFLAGS	+= -mlittle-endian
 CHECKFLAGS	+= -D__ARMEL__
 AS		+= -EL
-LD		+= -EL
+LDFLAGS		+= -EL
 endif
 
 #
-- 
2.7.4

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

* [PATCH 2/3] arm64: add endianness option to LDFLAGS instead of LD
  2018-07-03  1:21 [PATCH 0/3] arm, arm64, microblaze: add endianness options to LDFLAGS instead of LD Masahiro Yamada
  2018-07-03  1:21 ` [PATCH 1/3] ARM: add endianness option " Masahiro Yamada
@ 2018-07-03  1:22 ` Masahiro Yamada
  2018-07-04 16:30   ` Will Deacon
  2018-07-03  1:22 ` [PATCH 3/3] microblaze: add endianness options " Masahiro Yamada
  2 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2018-07-03  1:22 UTC (permalink / raw)
  To: linux-arm-kernel

With the recent syntax extension, Kconfig is now able to evaluate the
compiler / toolchain capability.

However, accumulating flags to 'LD' is not compatible with the way
it works; 'LD' must be passed to Kconfig to call $(ld-option,...)
from Kconfig files.  If you tweak 'LD' in arch Makefile depending on
CONFIG_CPU_BIG_ENDIAN, this would end up with circular dependency
between Makefile and Kconfig.

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

 arch/arm64/Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 4527226..8f73da3 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -60,15 +60,13 @@ ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
 KBUILD_CPPFLAGS	+= -mbig-endian
 CHECKFLAGS	+= -D__AARCH64EB__
 AS		+= -EB
-LD		+= -EB
-LDFLAGS		+= -maarch64linuxb
+LDFLAGS		+= -EB -maarch64linuxb
 UTS_MACHINE	:= aarch64_be
 else
 KBUILD_CPPFLAGS	+= -mlittle-endian
 CHECKFLAGS	+= -D__AARCH64EL__
 AS		+= -EL
-LD		+= -EL
-LDFLAGS		+= -maarch64linux
+LDFLAGS		+= -EL -maarch64linux
 UTS_MACHINE	:= aarch64
 endif
 
-- 
2.7.4

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

* [PATCH 3/3] microblaze: add endianness options to LDFLAGS instead of LD
  2018-07-03  1:21 [PATCH 0/3] arm, arm64, microblaze: add endianness options to LDFLAGS instead of LD Masahiro Yamada
  2018-07-03  1:21 ` [PATCH 1/3] ARM: add endianness option " Masahiro Yamada
  2018-07-03  1:22 ` [PATCH 2/3] arm64: " Masahiro Yamada
@ 2018-07-03  1:22 ` Masahiro Yamada
  2018-07-25  7:20   ` Michal Simek
  2 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2018-07-03  1:22 UTC (permalink / raw)
  To: linux-arm-kernel

With the recent syntax extension, Kconfig is now able to evaluate the
compiler / toolchain capability.

However, accumulating flags to 'LD' is not compatible with the way
it works; 'LD' must be passed to Kconfig to call $(ld-option,...)
from Kconfig files.  If you tweak 'LD' in arch Makefile depending on
CONFIG_CPU_BIG_ENDIAN, this would end up with circular dependency
between Makefile and Kconfig.

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

 arch/microblaze/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index d269dd4b..7333036 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -40,11 +40,11 @@ CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
 ifdef CONFIG_CPU_BIG_ENDIAN
 KBUILD_CFLAGS += -mbig-endian
 KBUILD_AFLAGS += -mbig-endian
-LD += -EB
+LDFLAGS += -EB
 else
 KBUILD_CFLAGS += -mlittle-endian
 KBUILD_AFLAGS += -mlittle-endian
-LD += -EL
+LDFLAGS += -EL
 endif
 
 CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
-- 
2.7.4

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

* [PATCH 2/3] arm64: add endianness option to LDFLAGS instead of LD
  2018-07-03  1:22 ` [PATCH 2/3] arm64: " Masahiro Yamada
@ 2018-07-04 16:30   ` Will Deacon
  0 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2018-07-04 16:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 03, 2018 at 10:22:00AM +0900, Masahiro Yamada wrote:
> With the recent syntax extension, Kconfig is now able to evaluate the
> compiler / toolchain capability.
> 
> However, accumulating flags to 'LD' is not compatible with the way
> it works; 'LD' must be passed to Kconfig to call $(ld-option,...)
> from Kconfig files.  If you tweak 'LD' in arch Makefile depending on
> CONFIG_CPU_BIG_ENDIAN, this would end up with circular dependency
> between Makefile and Kconfig.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---

Acked-by: Will Deacon <will.deacon@arm.com>

But note that this will conflict with:

http://lists.infradead.org/pipermail/linux-arm-kernel/2018-July/587726.html

Catalin -- I'm assuming you're taking both of these and will resolve the
conflict in the arm64 for-next/fixes branch.

Cheers,

Will

>  arch/arm64/Makefile | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index 4527226..8f73da3 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -60,15 +60,13 @@ ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
>  KBUILD_CPPFLAGS	+= -mbig-endian
>  CHECKFLAGS	+= -D__AARCH64EB__
>  AS		+= -EB
> -LD		+= -EB
> -LDFLAGS		+= -maarch64linuxb
> +LDFLAGS		+= -EB -maarch64linuxb
>  UTS_MACHINE	:= aarch64_be
>  else
>  KBUILD_CPPFLAGS	+= -mlittle-endian
>  CHECKFLAGS	+= -D__AARCH64EL__
>  AS		+= -EL
> -LD		+= -EL
> -LDFLAGS		+= -maarch64linux
> +LDFLAGS		+= -EL -maarch64linux
>  UTS_MACHINE	:= aarch64
>  endif
>  
> -- 
> 2.7.4
> 

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

* [PATCH 3/3] microblaze: add endianness options to LDFLAGS instead of LD
  2018-07-03  1:22 ` [PATCH 3/3] microblaze: add endianness options " Masahiro Yamada
@ 2018-07-25  7:20   ` Michal Simek
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Simek @ 2018-07-25  7:20 UTC (permalink / raw)
  To: linux-arm-kernel

On 3.7.2018 03:22, Masahiro Yamada wrote:
> With the recent syntax extension, Kconfig is now able to evaluate the
> compiler / toolchain capability.
> 
> However, accumulating flags to 'LD' is not compatible with the way
> it works; 'LD' must be passed to Kconfig to call $(ld-option,...)
> from Kconfig files.  If you tweak 'LD' in arch Makefile depending on
> CONFIG_CPU_BIG_ENDIAN, this would end up with circular dependency
> between Makefile and Kconfig.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  arch/microblaze/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
> index d269dd4b..7333036 100644
> --- a/arch/microblaze/Makefile
> +++ b/arch/microblaze/Makefile
> @@ -40,11 +40,11 @@ CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
>  ifdef CONFIG_CPU_BIG_ENDIAN
>  KBUILD_CFLAGS += -mbig-endian
>  KBUILD_AFLAGS += -mbig-endian
> -LD += -EB
> +LDFLAGS += -EB
>  else
>  KBUILD_CFLAGS += -mlittle-endian
>  KBUILD_AFLAGS += -mlittle-endian
> -LD += -EL
> +LDFLAGS += -EL
>  endif
>  
>  CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
> 

Applied to next.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP SoCs


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180725/12f8c158/attachment.sig>

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

end of thread, other threads:[~2018-07-25  7:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-03  1:21 [PATCH 0/3] arm, arm64, microblaze: add endianness options to LDFLAGS instead of LD Masahiro Yamada
2018-07-03  1:21 ` [PATCH 1/3] ARM: add endianness option " Masahiro Yamada
2018-07-03  1:22 ` [PATCH 2/3] arm64: " Masahiro Yamada
2018-07-04 16:30   ` Will Deacon
2018-07-03  1:22 ` [PATCH 3/3] microblaze: add endianness options " Masahiro Yamada
2018-07-25  7:20   ` Michal Simek

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