From: Helge Deller <deller@gmx.de>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: Helge Deller <deller@gmx.de>,
Parisc List <linux-parisc@vger.kernel.org>,
Meelis Roos <mroos@linux.ee>,
Linux Kernel Development <linux-kernel@vger.kernel.org>
Subject: Re: linux-parisc compile failure in current git
Date: Wed, 23 Jun 2021 22:33:02 +0200 [thread overview]
Message-ID: <YNOafsB81ZcP2r7z@ls3530> (raw)
In-Reply-To: <CAK7LNATO_30uHzAe-Vsy+hgu=wwEN_aPGET4Ys78rc3=nSuJsg@mail.gmail.com>
* Masahiro Yamada <masahiroy@kernel.org>:
> On Thu, Jun 10, 2021 at 4:04 PM Helge Deller <deller@gmx.de> wrote:
> >
> > Hi Masahiro,
> >
> > On 6/10/21 4:03 AM, Masahiro Yamada wrote:
> > > On Thu, Jun 10, 2021 at 7:50 AM Helge Deller <deller@gmx.de> wrote:
> > >>
> > >> On 6/1/21 12:21 PM, Meelis Roos wrote:
> > >>> Upstream Linux git fails to compile on gentoo hppa - .config below.
> > >>> I have 2 gcc-s as always:
> > >>> $ gcc-config -l
> > >>> [1] hppa2.0-unknown-linux-gnu-9.3.0
> > >>> [2] hppa2.0-unknown-linux-gnu-10.2.0 *
> > >>>
> > >>> [3] hppa64-unknown-linux-gnu-10.2.0 *
> > >>
> > >>
> > >> I see the same issue too, but only when compiling natively on a parisc machine.
> > >> Cross-compiling on a x86 box works nicely.
> > >>
> > >> First I thought it's a problem with setting the "cross_compiling" flag in ./Makefile.
> > >> But that's not sufficient.
> > >>
> > >> On a x86 machine (which builds fine) I get
> > >> SRCARCH=parisc SUBARCH=x86 UTS_MACHINE=parisc
> > >> The arch/parisc/kernel/asm-offsets.c file gets preprocessed via:
> > >> hppa64-linux-gnu-gcc
> > >>
> > >> On a native 32bit parisc machine I have:
> > >> SRCARCH=parisc SUBARCH=parisc UTS_MACHINE=parisc
> > >> Here the arch/parisc/kernel/asm-offsets.c file gets preprocessed via:
> > >> gcc
> > >> Instead here the native hppa64-linux-gnu-gcc (cross compiler) should have been used too, since
> > >> we build a 64-bit hppa kernel (CONFIG_64BIT is set).
> > >> Note, on hppa we don't have an "-m64" compiler flag as on x86.
> > >
> > > I see.
> > > hppa is not a bi-arch compiler, in other words,
> > > http- and hppa64- are separate compilers.
> >
> > Yes.
> >
> > >> Mashahiro, do you maybe have an idea what gets wrong here, or which
> > >> patch has changed the behaviour how the asm-offsets.c file gets preprocessed?
> > >
> > > Presumably, commit 23243c1ace9fb4eae2f75e0fe0ece8e3219fb4f3
> > >
> > > Prior to that commit, arch/parisc/Makefile was like this:
> > >
> > > ifneq ($(SUBARCH),$(UTS_MACHINE))
> > > ifeq ($(CROSS_COMPILE),)
> > > ...
> > >
> > > Now I understand why arch/parisc/Makefile was written this way.
> > >
> > > Reverting the change in arch/parisc/Makefile will restore the original behavior.
> >
> > Sadly, reverting this change (23243c1ace9fb4eae2f75e0fe0ece8e3219fb4f3) does not
> > restore the original behavior.
> >
> > > But, please keep in mind that there is an issue remaining.
> > >
> > > Please see this code:
> > >
> > > ifdef CONFIG_64BIT
> > > UTS_MACHINE := parisc64
> > > CHECKFLAGS += -D__LP64__=1
> > > CC_ARCHES = hppa64
> > > LD_BFD := elf64-hppa-linux
> > > else # 32-bit
> > > CC_ARCHES = hppa hppa2.0 hppa1.1
> > > LD_BFD := elf32-hppa-linux
> > > endif
> > >
> > >
> > > UTS_MACHINE is determined by CONFIG_64BIT.
> > >
> > > CONFIG_64BIT is defined only after Kconfig is finished.
> > > When you are trying to configure the .config,
> > > CONFIG_64BIT is not defined yet.
> > > So UTS_MACHINE is always 'parisc'.
> >
> > Yes.
> > See above, but it worked when I had SUBARCH=x86 (when running my laptop).
> >
> >
> > > As you know, Kconfig files now have a bunch of 'cc-option' syntax
> > > to check the compiler capability in Kconfig time.
> > > Hence, you need to provide a proper compiler in Kconfig time too.
> > >
> > > When you build a 64-bit parisc kernel on a 32-bit parisc machine,
> >
> > Please note, that we don't have a 64-bit parisc userspace yet (just kernel).
> > This means, that all builds on parisc machines are 32bit and do a
> > cross-compilation to a parisc64 kernel if requested in the .config.
> >
> > > Kconfig is passed with CC=gcc since SUBARCH==UTS_MACHINE==parisc.
> > > After Kconfig, CROSS_COMPILE=hppa64-* is set,
> > > and the kernel is built by CC=hppa64-*-gcc.
> >
> > Right. That is the old behaviour. Based on the CONFIG_64BIT option
> > the hppa64 compiler is choosen for CROSS_COMPILE.
> >
> > > So, Kconfig evaluated a compiletely different compiler. This is pointless.
> >
> > Yes, probably.
> >
> >
> > > There are some options
> > >
> > > [option 1]
> > > revert the parisc bit of 23243c1ace9fb4eae2f75e0fe0ece8e3219fb4f3
> > > This will restore the functionality you may want, but
> > > as I said above, Kconfig is doing pointless things.
> >
> > as mentioned above: Doesn't solve the issue.
> >
> > > [option 2]
> > > Stop using cc-cross-prefix, and pass CROSS_COMPILE explicitly.
> > > This is what many architectures including arm, arm64 do.
> > > You need to explicitly pass CROSS_COMPILE=aarch64-linux-gnu- etc.
> > > if you are cross-compiling arm64.
> >
> > Might be an option, but it's not as handy as simply choosing CONFIG_64BIT
> > and then things are done automatically.
> >
> > > [option 3]
> > > Introduce ARCH=parisc64.
> > >
> > > When you are building 64-bit kernel, you can pass ARCH=parisc64
> > > A patch attached. (but not tested much)
> >
> > Tried it, but doesn't work.
> > asm-offsets.c is still preprocessed with 32bit compiler (gcc, not hppa20-gcc).
> >
> > Thanks for your help so far!
> > If you like I'm happy to give you an account on a hppa64 machine to reproduce yourself.
> > I'll now try to bisect where it goes wrong. There must be something else before commit 23243c1ace9fb4eae2f75e0fe0ece8e3219fb4f3.
> >
> > Helge
>
>
> Sorry for my late reply.
Me too.... :-(
> Did git-bisect find something?
No. But I understood, that it's not a new problem.
It existed already before.
> If necessary, I will be happy to try it on the hppa64 machine.
Yes, please.
I'll send you login details in a private mail.
Attached is my last test patch (which is based on yours).
Helge
-----
diff --git a/Makefile b/Makefile
index ed669b2d705d..47a972f859f5 100644
--- a/Makefile
+++ b/Makefile
@@ -399,6 +399,11 @@ ifeq ($(ARCH),sparc64)
SRCARCH := sparc
endif
+# Additional ARCH settings for parisc
+ifeq ($(ARCH),parisc64)
+ SRCARCH := parisc
+endif
+
export cross_compiling :=
ifneq ($(SRCARCH),$(SUBARCH))
cross_compiling := 1
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index aed8ea29268b..ee5890a2f62d 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -25,18 +25,21 @@ CHECKFLAGS += -D__hppa__=1
ifdef CONFIG_64BIT
UTS_MACHINE := parisc64
CHECKFLAGS += -D__LP64__=1
-CC_ARCHES = hppa64
LD_BFD := elf64-hppa-linux
else # 32-bit
-CC_ARCHES = hppa hppa2.0 hppa1.1
LD_BFD := elf32-hppa-linux
endif
# select defconfig based on actual architecture
-ifeq ($(shell uname -m),parisc64)
+ifeq ($(ARCH),parisc64)
KBUILD_DEFCONFIG := generic-64bit_defconfig
+ CC_ARCHES := hppa64
+else ifdef CONFIG_64BIT
+ KBUILD_DEFCONFIG := generic-64bit_defconfig
+ CC_ARCHES := hppa64
else
KBUILD_DEFCONFIG := generic-32bit_defconfig
+ CC_ARCHES := hppa hppa2.0 hppa1.1
endif
export LD_BFD
diff --git a/scripts/subarch.include b/scripts/subarch.include
index 650682821126..776849a3c500 100644
--- a/scripts/subarch.include
+++ b/scripts/subarch.include
@@ -7,7 +7,7 @@
SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
-e s/sun4u/sparc64/ \
-e s/arm.*/arm/ -e s/sa110/arm/ \
- -e s/s390x/s390/ -e s/parisc64/parisc/ \
+ -e s/s390x/s390/ \
-e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
-e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
-e s/riscv.*/riscv/)
next prev parent reply other threads:[~2021-06-23 20:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 10:21 linux-parisc compile failure in current git Meelis Roos
[not found] ` <1ebff319-ad1d-0b83-d0b8-e3c88a8f3e48@gmx.de>
2021-06-09 15:31 ` Meelis Roos
2021-06-09 16:34 ` John David Anglin
2021-06-09 22:49 ` Helge Deller
2021-06-10 2:03 ` Masahiro Yamada
2021-06-10 7:03 ` Helge Deller
2021-06-17 1:47 ` Masahiro Yamada
2021-06-23 20:33 ` Helge Deller [this message]
2022-08-17 20:59 ` Randy Dunlap
2022-08-19 10:38 ` Helge Deller
2022-08-19 12:45 ` Masahiro Yamada
2022-08-19 13:54 ` Helge Deller
2022-08-19 16:41 ` Masahiro Yamada
2022-08-19 17:58 ` Helge Deller
2022-08-20 1:22 ` Randy Dunlap
2022-08-20 1:17 ` Randy Dunlap
2021-06-10 15:13 ` Meelis Roos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YNOafsB81ZcP2r7z@ls3530 \
--to=deller@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=mroos@linux.ee \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.