All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: support __int128 with clang
@ 2017-12-23  0:43 ` Jason A. Donenfeld
  0 siblings, 0 replies; 14+ messages in thread
From: Jason A. Donenfeld @ 2017-12-23  0:43 UTC (permalink / raw)
  To: Will Deacon, linux-arm-kernel, LKML; +Cc: Jason A. Donenfeld

Commit fb8722735f50 ("arm64: support __int128 on gcc 5+") added support
for arm64 __int128 with gcc with a version-conditional, but neglected to
enable this for clang, which in fact appears to support aarch64 __int128.
This commit therefore enables it if the compiler is clang, using the
same type of makefile conditional used elsewhere in the tree.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 arch/arm64/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index b481b4a7c011..16c2e8b58546 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -57,7 +57,11 @@ KBUILD_AFLAGS	+= $(lseinstr) $(brokengasinst)
 KBUILD_CFLAGS	+= $(call cc-option,-mabi=lp64)
 KBUILD_AFLAGS	+= $(call cc-option,-mabi=lp64)
 
+ifeq ($(cc-name),clang)
+KBUILD_CFLAGS	+= -DCONFIG_ARCH_SUPPORTS_INT128
+else
 KBUILD_CFLAGS	+= $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128)
+endif
 
 ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
 KBUILD_CPPFLAGS	+= -mbig-endian
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH] arm64: support __int128 with clang
@ 2017-12-23  0:43 ` Jason A. Donenfeld
  0 siblings, 0 replies; 14+ messages in thread
From: Jason A. Donenfeld @ 2017-12-23  0:43 UTC (permalink / raw)
  To: linux-arm-kernel

Commit fb8722735f50 ("arm64: support __int128 on gcc 5+") added support
for arm64 __int128 with gcc with a version-conditional, but neglected to
enable this for clang, which in fact appears to support aarch64 __int128.
This commit therefore enables it if the compiler is clang, using the
same type of makefile conditional used elsewhere in the tree.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 arch/arm64/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index b481b4a7c011..16c2e8b58546 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -57,7 +57,11 @@ KBUILD_AFLAGS	+= $(lseinstr) $(brokengasinst)
 KBUILD_CFLAGS	+= $(call cc-option,-mabi=lp64)
 KBUILD_AFLAGS	+= $(call cc-option,-mabi=lp64)
 
+ifeq ($(cc-name),clang)
+KBUILD_CFLAGS	+= -DCONFIG_ARCH_SUPPORTS_INT128
+else
 KBUILD_CFLAGS	+= $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128)
+endif
 
 ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
 KBUILD_CPPFLAGS	+= -mbig-endian
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] arm64: support __int128 with clang
  2017-12-23  0:43 ` Jason A. Donenfeld
@ 2018-04-15 16:20   ` Jason A. Donenfeld
  -1 siblings, 0 replies; 14+ messages in thread
From: Jason A. Donenfeld @ 2018-04-15 16:20 UTC (permalink / raw)
  To: Will Deacon, linux-arm-kernel, LKML, Ard Biesheuvel

Hi Will,

Would you review/merge this when you have a chance?

Thanks,
Jason

On Sat, Dec 23, 2017 at 1:43 AM, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> Commit fb8722735f50 ("arm64: support __int128 on gcc 5+") added support
> for arm64 __int128 with gcc with a version-conditional, but neglected to
> enable this for clang, which in fact appears to support aarch64 __int128.
> This commit therefore enables it if the compiler is clang, using the
> same type of makefile conditional used elsewhere in the tree.
>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  arch/arm64/Makefile | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index b481b4a7c011..16c2e8b58546 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -57,7 +57,11 @@ KBUILD_AFLAGS        += $(lseinstr) $(brokengasinst)
>  KBUILD_CFLAGS  += $(call cc-option,-mabi=lp64)
>  KBUILD_AFLAGS  += $(call cc-option,-mabi=lp64)
>
> +ifeq ($(cc-name),clang)
> +KBUILD_CFLAGS  += -DCONFIG_ARCH_SUPPORTS_INT128
> +else
>  KBUILD_CFLAGS  += $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128)
> +endif
>
>  ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
>  KBUILD_CPPFLAGS        += -mbig-endian
> --
> 2.15.1
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] arm64: support __int128 with clang
@ 2018-04-15 16:20   ` Jason A. Donenfeld
  0 siblings, 0 replies; 14+ messages in thread
From: Jason A. Donenfeld @ 2018-04-15 16:20 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Will,

Would you review/merge this when you have a chance?

Thanks,
Jason

On Sat, Dec 23, 2017 at 1:43 AM, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> Commit fb8722735f50 ("arm64: support __int128 on gcc 5+") added support
> for arm64 __int128 with gcc with a version-conditional, but neglected to
> enable this for clang, which in fact appears to support aarch64 __int128.
> This commit therefore enables it if the compiler is clang, using the
> same type of makefile conditional used elsewhere in the tree.
>
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  arch/arm64/Makefile | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index b481b4a7c011..16c2e8b58546 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -57,7 +57,11 @@ KBUILD_AFLAGS        += $(lseinstr) $(brokengasinst)
>  KBUILD_CFLAGS  += $(call cc-option,-mabi=lp64)
>  KBUILD_AFLAGS  += $(call cc-option,-mabi=lp64)
>
> +ifeq ($(cc-name),clang)
> +KBUILD_CFLAGS  += -DCONFIG_ARCH_SUPPORTS_INT128
> +else
>  KBUILD_CFLAGS  += $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128)
> +endif
>
>  ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
>  KBUILD_CPPFLAGS        += -mbig-endian
> --
> 2.15.1
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] arm64: support __int128 with clang
  2018-04-15 16:20   ` Jason A. Donenfeld
@ 2018-04-24 13:35     ` Will Deacon
  -1 siblings, 0 replies; 14+ messages in thread
From: Will Deacon @ 2018-04-24 13:35 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: linux-arm-kernel, LKML, Ard Biesheuvel, mark.rutland

On Sun, Apr 15, 2018 at 06:20:11PM +0200, Jason A. Donenfeld wrote:
> Would you review/merge this when you have a chance?

No real objection from me, but does the arm64 kernel actually build with
clang?

Will

> On Sat, Dec 23, 2017 at 1:43 AM, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> > Commit fb8722735f50 ("arm64: support __int128 on gcc 5+") added support
> > for arm64 __int128 with gcc with a version-conditional, but neglected to
> > enable this for clang, which in fact appears to support aarch64 __int128.
> > This commit therefore enables it if the compiler is clang, using the
> > same type of makefile conditional used elsewhere in the tree.
> >
> > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> > ---
> >  arch/arm64/Makefile | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> > index b481b4a7c011..16c2e8b58546 100644
> > --- a/arch/arm64/Makefile
> > +++ b/arch/arm64/Makefile
> > @@ -57,7 +57,11 @@ KBUILD_AFLAGS        += $(lseinstr) $(brokengasinst)
> >  KBUILD_CFLAGS  += $(call cc-option,-mabi=lp64)
> >  KBUILD_AFLAGS  += $(call cc-option,-mabi=lp64)
> >
> > +ifeq ($(cc-name),clang)
> > +KBUILD_CFLAGS  += -DCONFIG_ARCH_SUPPORTS_INT128
> > +else
> >  KBUILD_CFLAGS  += $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128)
> > +endif
> >
> >  ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
> >  KBUILD_CPPFLAGS        += -mbig-endian
> > --
> > 2.15.1
> >

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] arm64: support __int128 with clang
@ 2018-04-24 13:35     ` Will Deacon
  0 siblings, 0 replies; 14+ messages in thread
From: Will Deacon @ 2018-04-24 13:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Apr 15, 2018 at 06:20:11PM +0200, Jason A. Donenfeld wrote:
> Would you review/merge this when you have a chance?

No real objection from me, but does the arm64 kernel actually build with
clang?

Will

> On Sat, Dec 23, 2017 at 1:43 AM, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> > Commit fb8722735f50 ("arm64: support __int128 on gcc 5+") added support
> > for arm64 __int128 with gcc with a version-conditional, but neglected to
> > enable this for clang, which in fact appears to support aarch64 __int128.
> > This commit therefore enables it if the compiler is clang, using the
> > same type of makefile conditional used elsewhere in the tree.
> >
> > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> > ---
> >  arch/arm64/Makefile | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> > index b481b4a7c011..16c2e8b58546 100644
> > --- a/arch/arm64/Makefile
> > +++ b/arch/arm64/Makefile
> > @@ -57,7 +57,11 @@ KBUILD_AFLAGS        += $(lseinstr) $(brokengasinst)
> >  KBUILD_CFLAGS  += $(call cc-option,-mabi=lp64)
> >  KBUILD_AFLAGS  += $(call cc-option,-mabi=lp64)
> >
> > +ifeq ($(cc-name),clang)
> > +KBUILD_CFLAGS  += -DCONFIG_ARCH_SUPPORTS_INT128
> > +else
> >  KBUILD_CFLAGS  += $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128)
> > +endif
> >
> >  ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
> >  KBUILD_CPPFLAGS        += -mbig-endian
> > --
> > 2.15.1
> >

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] arm64: support __int128 with clang
  2018-04-24 13:35     ` Will Deacon
@ 2018-04-24 13:47       ` Jason A. Donenfeld
  -1 siblings, 0 replies; 14+ messages in thread
From: Jason A. Donenfeld @ 2018-04-24 13:47 UTC (permalink / raw)
  To: Will Deacon; +Cc: linux-arm-kernel, LKML, Ard Biesheuvel, Mark Rutland

On Tue, Apr 24, 2018 at 3:35 PM, Will Deacon <will.deacon@arm.com> wrote:
> On Sun, Apr 15, 2018 at 06:20:11PM +0200, Jason A. Donenfeld wrote:
>> Would you review/merge this when you have a chance?
>
> No real objection from me, but does the arm64 kernel actually build with
> clang?

I've been told that Android is moving their kernel builds over to
clang entirely.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] arm64: support __int128 with clang
@ 2018-04-24 13:47       ` Jason A. Donenfeld
  0 siblings, 0 replies; 14+ messages in thread
From: Jason A. Donenfeld @ 2018-04-24 13:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Apr 24, 2018 at 3:35 PM, Will Deacon <will.deacon@arm.com> wrote:
> On Sun, Apr 15, 2018 at 06:20:11PM +0200, Jason A. Donenfeld wrote:
>> Would you review/merge this when you have a chance?
>
> No real objection from me, but does the arm64 kernel actually build with
> clang?

I've been told that Android is moving their kernel builds over to
clang entirely.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] arm64: support __int128 with clang
  2018-04-24 13:35     ` Will Deacon
@ 2018-04-24 13:56       ` Mark Rutland
  -1 siblings, 0 replies; 14+ messages in thread
From: Mark Rutland @ 2018-04-24 13:56 UTC (permalink / raw)
  To: Will Deacon; +Cc: Jason A. Donenfeld, linux-arm-kernel, LKML, Ard Biesheuvel

On Tue, Apr 24, 2018 at 02:35:27PM +0100, Will Deacon wrote:
> On Sun, Apr 15, 2018 at 06:20:11PM +0200, Jason A. Donenfeld wrote:
> > Would you review/merge this when you have a chance?
> 
> No real objection from me, but does the arm64 kernel actually build with
> clang?

I belevie that currently it is not possible to use a released version of
clang to build a working kernel without additional patches (at least
5.0.0, there don't seem to be any 6.0.0 binaries that can target
AArch64). Issues include:

* Released versions of clang don't support the 's' constraint used in
  some hyp code.

* Released versions of clang don't support 'rX' as a register name, as
  is used by some workaround code shared between arm/arm64.

* Additional flags need to be passed for hyp code to function correctly,
  since clang will convert switch statements into jump tables, meaning
  they aren't position-independent.

I tried building a tip-of-tree clang recently (r330441 with llvm
r330440) to see what was solved so far, but this blew up when bulding
the kernel, and I was going to wait for the 7.0.0 release before trying
again.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] arm64: support __int128 with clang
@ 2018-04-24 13:56       ` Mark Rutland
  0 siblings, 0 replies; 14+ messages in thread
From: Mark Rutland @ 2018-04-24 13:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Apr 24, 2018 at 02:35:27PM +0100, Will Deacon wrote:
> On Sun, Apr 15, 2018 at 06:20:11PM +0200, Jason A. Donenfeld wrote:
> > Would you review/merge this when you have a chance?
> 
> No real objection from me, but does the arm64 kernel actually build with
> clang?

I belevie that currently it is not possible to use a released version of
clang to build a working kernel without additional patches (at least
5.0.0, there don't seem to be any 6.0.0 binaries that can target
AArch64). Issues include:

* Released versions of clang don't support the 's' constraint used in
  some hyp code.

* Released versions of clang don't support 'rX' as a register name, as
  is used by some workaround code shared between arm/arm64.

* Additional flags need to be passed for hyp code to function correctly,
  since clang will convert switch statements into jump tables, meaning
  they aren't position-independent.

I tried building a tip-of-tree clang recently (r330441 with llvm
r330440) to see what was solved so far, but this blew up when bulding
the kernel, and I was going to wait for the 7.0.0 release before trying
again.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] arm64: support __int128 with clang
  2018-04-24 13:47       ` Jason A. Donenfeld
@ 2018-04-24 13:59         ` Jason A. Donenfeld
  -1 siblings, 0 replies; 14+ messages in thread
From: Jason A. Donenfeld @ 2018-04-24 13:59 UTC (permalink / raw)
  To: Will Deacon; +Cc: linux-arm-kernel, LKML, Ard Biesheuvel, Mark Rutland

On Tue, Apr 24, 2018 at 3:47 PM, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> On Tue, Apr 24, 2018 at 3:35 PM, Will Deacon <will.deacon@arm.com> wrote:
>> On Sun, Apr 15, 2018 at 06:20:11PM +0200, Jason A. Donenfeld wrote:
>>> Would you review/merge this when you have a chance?
>>
>> No real objection from me, but does the arm64 kernel actually build with
>> clang?
>
> I've been told that Android is moving their kernel builds over to
> clang entirely.

More info:
https://github.com/nathanchance/android-kernel-clang
https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/#llvm-users
https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/809774

I think we have good reason for merging this patch.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] arm64: support __int128 with clang
@ 2018-04-24 13:59         ` Jason A. Donenfeld
  0 siblings, 0 replies; 14+ messages in thread
From: Jason A. Donenfeld @ 2018-04-24 13:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Apr 24, 2018 at 3:47 PM, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> On Tue, Apr 24, 2018 at 3:35 PM, Will Deacon <will.deacon@arm.com> wrote:
>> On Sun, Apr 15, 2018 at 06:20:11PM +0200, Jason A. Donenfeld wrote:
>>> Would you review/merge this when you have a chance?
>>
>> No real objection from me, but does the arm64 kernel actually build with
>> clang?
>
> I've been told that Android is moving their kernel builds over to
> clang entirely.

More info:
https://github.com/nathanchance/android-kernel-clang
https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/#llvm-users
https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/809774

I think we have good reason for merging this patch.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] arm64: support __int128 with clang
  2018-04-24 13:56       ` Mark Rutland
@ 2018-04-24 14:17         ` Mark Rutland
  -1 siblings, 0 replies; 14+ messages in thread
From: Mark Rutland @ 2018-04-24 14:17 UTC (permalink / raw)
  To: Will Deacon; +Cc: Jason A. Donenfeld, linux-arm-kernel, LKML, Ard Biesheuvel

On Tue, Apr 24, 2018 at 02:56:09PM +0100, Mark Rutland wrote:
> I belevie that currently it is not possible to use a released version of
> clang to build a working kernel without additional patches (at least
> 5.0.0, there don't seem to be any 6.0.0 binaries that can target
> AArch64). Issues include:
> 
> * Released versions of clang don't support the 's' constraint used in
>   some hyp code.
> 

> * Released versions of clang don't support 'rX' as a register name, as
>   is used by some workaround code shared between arm/arm64.

This case will apparently be fixed for 6.0.1 (and presumably 7.0.0):

https://reviews.llvm.org/rL328829
https://bugs.llvm.org/show_bug.cgi?id=36862

Neither have been released yet.

Mark.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] arm64: support __int128 with clang
@ 2018-04-24 14:17         ` Mark Rutland
  0 siblings, 0 replies; 14+ messages in thread
From: Mark Rutland @ 2018-04-24 14:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Apr 24, 2018 at 02:56:09PM +0100, Mark Rutland wrote:
> I belevie that currently it is not possible to use a released version of
> clang to build a working kernel without additional patches (at least
> 5.0.0, there don't seem to be any 6.0.0 binaries that can target
> AArch64). Issues include:
> 
> * Released versions of clang don't support the 's' constraint used in
>   some hyp code.
> 

> * Released versions of clang don't support 'rX' as a register name, as
>   is used by some workaround code shared between arm/arm64.

This case will apparently be fixed for 6.0.1 (and presumably 7.0.0):

https://reviews.llvm.org/rL328829
https://bugs.llvm.org/show_bug.cgi?id=36862

Neither have been released yet.

Mark.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-04-24 14:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-23  0:43 [PATCH] arm64: support __int128 with clang Jason A. Donenfeld
2017-12-23  0:43 ` Jason A. Donenfeld
2018-04-15 16:20 ` Jason A. Donenfeld
2018-04-15 16:20   ` Jason A. Donenfeld
2018-04-24 13:35   ` Will Deacon
2018-04-24 13:35     ` Will Deacon
2018-04-24 13:47     ` Jason A. Donenfeld
2018-04-24 13:47       ` Jason A. Donenfeld
2018-04-24 13:59       ` Jason A. Donenfeld
2018-04-24 13:59         ` Jason A. Donenfeld
2018-04-24 13:56     ` Mark Rutland
2018-04-24 13:56       ` Mark Rutland
2018-04-24 14:17       ` Mark Rutland
2018-04-24 14:17         ` Mark Rutland

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.