[Skiboot] [PATCH] external: remove CROSS_COMPILE from get_arch.sh
Cyril Bur
cyril.bur at au1.ibm.com
Wed Aug 3 16:36:42 AEST 2016
On Wed, 3 Aug 2016 13:41:19 +1000
Oliver O'Halloran <oohall at gmail.com> wrote:
> The intended usage of CROSS_COMPILE is to supply the common toolchain
> prefix so that CC, LD, etc can be set automatically by make. Build systems
> that set these variables directly don't need (or want) this behaviour so
> using CROSS_COMPILE for any other purpose is inherently broken.
>
> Currently CROSS_COMPILE is used to set CC/LD (as above), but it is also
> used when determining the target architecture. The implementation of this
> only requires CROSS_COMPILE set be set so get_arch.sh can use the cross
> toolchain's the C preprocessor directly. This is unnecessary since
> equivalent functionality can be achieved using CC in preprocessor mode
> with the -E flag which is supported by both gcc and clang.
>
> Cc: Cyril Bur <cyril.bur at au1.ibm.com>
> Cc: Patrick Williams <patrick at stwcx.xyz>
> Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
> ---
> external/common/get_arch.sh | 2 +-
> external/common/rules.mk | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/external/common/get_arch.sh b/external/common/get_arch.sh
> index f4beb1df4faf..084cf79acdcf 100755
> --- a/external/common/get_arch.sh
> +++ b/external/common/get_arch.sh
> @@ -7,5 +7,5 @@ echo -n ARCH_X86
> echo -n ARCH_ARM
> #else
> echo -n ARCH_UNKNOWN
> -#endif" | $1cpp | /bin/sh
> +#endif" | $1 -E - | /bin/sh
>
> diff --git a/external/common/rules.mk b/external/common/rules.mk
> index bb12fd5b286b..172dda7113d8 100644
> --- a/external/common/rules.mk
> +++ b/external/common/rules.mk
> @@ -1,6 +1,6 @@
> CC ?= $(CROSS_COMPILE)gcc
> LD ?= $(CROSS_COMPILE)ld
Will need my patch otherwise CC will remain the system compiler which on my
laptop yields an x86 binary despite giving an arm CROSS_COMPILE.
With both patches applied appears to do work for me.
> -ARCH := $(shell $(GET_ARCH) "$(CROSS_COMPILE)")
> +ARCH := $(shell $(GET_ARCH) "$(CC)")
>
> ifeq ($(ARCH),ARCH_ARM)
> arch := arm
More information about the Skiboot
mailing list