lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 10 Jun 2021 11:03:31 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     Helge Deller <deller@....de>
Cc:     Parisc List <linux-parisc@...r.kernel.org>,
        Meelis Roos <mroos@...ux.ee>,
        Linux Kernel Development <linux-kernel@...r.kernel.org>
Subject: Re: linux-parisc compile failure in current git

Hi Helge,


On Thu, Jun 10, 2021 at 7:50 AM Helge Deller <deller@....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.



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

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

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,
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.
So, Kconfig evaluated a compiletely different compiler. This is pointless.


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.

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

[option 3]
   Introduce ARCH=parisc64.

   When you are building 64-bit kernel, you can pass ARCH=parisc64

    A patch attached.  (but not tested much)



--
Best Regards

Masahiro Yamada

Download attachment "parisc64.diff" of type "application/x-patch" (1573 bytes)

Powered by blists - more mailing lists