2018-07-03 01:26:03

by Masahiro Yamada

[permalink] [raw]
Subject: [PATCH 0/3] arm,arm64,microblaze: add endianness options to LDFLAGS instead of LD


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



2018-07-03 01:25:40

by Masahiro Yamada

[permalink] [raw]
Subject: [PATCH 1/3] ARM: add endianness option to LDFLAGS instead of LD

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 <[email protected]>
---

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


2018-07-03 01:25:58

by Masahiro Yamada

[permalink] [raw]
Subject: [PATCH 2/3] arm64: add endianness option to LDFLAGS instead of LD

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 <[email protected]>
---

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


2018-07-03 01:27:37

by Masahiro Yamada

[permalink] [raw]
Subject: [PATCH 3/3] microblaze: add endianness options to LDFLAGS instead of LD

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 <[email protected]>
---

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


2018-07-04 16:30:51

by Will Deacon

[permalink] [raw]
Subject: Re: [PATCH 2/3] arm64: add endianness option to LDFLAGS instead of LD

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 <[email protected]>
> ---

Acked-by: Will Deacon <[email protected]>

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
>

2018-07-24 01:55:32

by Masahiro Yamada

[permalink] [raw]
Subject: Re: [PATCH 3/3] microblaze: add endianness options to LDFLAGS instead of LD

Hi Michal,

Ping?


2018-07-03 10:22 GMT+09:00 Masahiro Yamada <[email protected]>:
> 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 <[email protected]>
> ---
>
> 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
>



--
Best Regards
Masahiro Yamada

2018-07-25 07:22:12

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH 3/3] microblaze: add endianness options to LDFLAGS instead of LD

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 <[email protected]>
> ---
>
> 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: http://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



Attachments:
signature.asc (205.00 B)
OpenPGP digital signature