Message ID | 20180510051659.15356-5-npiggin@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Nicholas Piggin <npiggin@gmail.com> writes: > The powerpc toolchain can compile combinations of 32/64 bit and > big/little endian, so it's convenient to consider, e.g., > > `CC -m64 -mbig-endian` > > To be the C compiler for the purpose of invoking it to build target > artifacts. So overriding the the CC variable to include thse flags > works for this purpose. > > Unfortunately that is not compatible with the way the proposed new > Kconfig macro language will work. > > After previous patches in this series, these flags can be carefully > passed in using flags instead. > > Signed-off-by: Nicholas Piggin <npiggin@gmail.com> > --- > arch/powerpc/Makefile | 16 +++++++++------- > scripts/recordmcount.pl | 8 ++++++++ We should probably at least Cc Rostedt on the recordmcount.pl change. > diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl > index 191eb949d52c..919711dd9d6c 100755 > --- a/scripts/recordmcount.pl > +++ b/scripts/recordmcount.pl > @@ -274,6 +274,14 @@ if ($arch eq "x86_64") { Despite what the above says you're patching the powerpc entry AFAICS, so I guess that's pretty harmless. > if ($bits == 64) { > $type = ".quad"; > } > + $ld .= " -EB "; > + if ($endian eq "big") { > + $cc .= " -mbig-endian "; > + $ld .= " -EB "; Don't we end up with two "-EB"s for the big endian case? Or do I understand perl even less than I thought I did? > + } else { > + $cc .= " -mlittle-endian "; > + $ld .= " -EL "; > + } > > } elsif ($arch eq "arm") { > $alignment = 2; cheers -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 10 May 2018 23:03:08 +1000 Michael Ellerman <mpe@ellerman.id.au> wrote: > Nicholas Piggin <npiggin@gmail.com> writes: > > > The powerpc toolchain can compile combinations of 32/64 bit and > > big/little endian, so it's convenient to consider, e.g., > > > > `CC -m64 -mbig-endian` > > > > To be the C compiler for the purpose of invoking it to build target > > artifacts. So overriding the the CC variable to include thse flags > > works for this purpose. > > > > Unfortunately that is not compatible with the way the proposed new > > Kconfig macro language will work. > > > > After previous patches in this series, these flags can be carefully > > passed in using flags instead. > > > > Signed-off-by: Nicholas Piggin <npiggin@gmail.com> > > --- > > arch/powerpc/Makefile | 16 +++++++++------- > > scripts/recordmcount.pl | 8 ++++++++ > > We should probably at least Cc Rostedt on the recordmcount.pl change. Sure I'll send another iteration after some more time for reviews and cc him on it. > > > diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl > > index 191eb949d52c..919711dd9d6c 100755 > > --- a/scripts/recordmcount.pl > > +++ b/scripts/recordmcount.pl > > @@ -274,6 +274,14 @@ if ($arch eq "x86_64") { > > Despite what the above says you're patching the powerpc entry AFAICS, so > I guess that's pretty harmless. Yeah I didn't think it was worth a separate patch. > > > if ($bits == 64) { > > $type = ".quad"; > > } > > + $ld .= " -EB "; > > + if ($endian eq "big") { > > + $cc .= " -mbig-endian "; > > + $ld .= " -EB "; > > Don't we end up with two "-EB"s for the big endian case? > > Or do I understand perl even less than I thought I did? No I was testing things and that's leaked into the commit. Good eye. I think it worked for le because the next -EL will override the first -EB, but I'll take that out. Thanks, Nick -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index a40f59ca2afe..5f3ec8029e50 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -70,13 +70,15 @@ endif endif ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) -override LD += -EL +KBUILD_CFLAGS += -mlittle-endian +LDFLAGS += -EL LDEMULATION := lppc GNUTARGET := powerpcle MULTIPLEWORD := -mno-multiple KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect) else -override LD += -EB +KBUILD_CFLAGS += $(call cc-option,-mbig-endian) +LDFLAGS += -EB LDEMULATION := ppc GNUTARGET := powerpc MULTIPLEWORD := -mmultiple @@ -89,19 +91,19 @@ aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2 endif -cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian -cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) ifneq ($(cc-name),clang) cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align endif +cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) +cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian ifeq ($(HAS_BIARCH),y) -override AS += -a$(BITS) -override LD += -m elf$(BITS)$(LDEMULATION) -override CC += -m$(BITS) +KBUILD_CFLAGS += -m$(BITS) +KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS) +LDFLAGS += -m elf$(BITS)$(LDEMULATION) KBUILD_ARFLAGS += --target=elf$(BITS)-$(GNUTARGET) endif diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 191eb949d52c..919711dd9d6c 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -274,6 +274,14 @@ if ($arch eq "x86_64") { if ($bits == 64) { $type = ".quad"; } + $ld .= " -EB "; + if ($endian eq "big") { + $cc .= " -mbig-endian "; + $ld .= " -EB "; + } else { + $cc .= " -mlittle-endian "; + $ld .= " -EL "; + } } elsif ($arch eq "arm") { $alignment = 2;
The powerpc toolchain can compile combinations of 32/64 bit and big/little endian, so it's convenient to consider, e.g., `CC -m64 -mbig-endian` To be the C compiler for the purpose of invoking it to build target artifacts. So overriding the the CC variable to include thse flags works for this purpose. Unfortunately that is not compatible with the way the proposed new Kconfig macro language will work. After previous patches in this series, these flags can be carefully passed in using flags instead. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> --- arch/powerpc/Makefile | 16 +++++++++------- scripts/recordmcount.pl | 8 ++++++++ 2 files changed, 17 insertions(+), 7 deletions(-)