All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] minor build fixes
@ 2016-11-23 13:02 Nicholas Piggin
  2016-11-23 13:02 ` [PATCH 1/3] powerpc/64e: convert cmpi to cmpwi in head_64.S Nicholas Piggin
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Nicholas Piggin @ 2016-11-23 13:02 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin, Alan Modra

I was building BookE and big endian with a little endian cross
compiler and it stopped working. My BookS BE tests must have been
building using the ELFv2 ABI. After this, the build sometimes still
strangely fails with dot symbols in syscall table unable to be found,
but that's looking like it may be a linker bug (Alan is going to take
a look).

Thanks,
Nick

Nicholas Piggin (3):
  powerpc/64e: convert cmpi to cmpwi in head_64.S
  powerpc: allow compilation on cross-endian toolchain
  powerpc/64e: don't branch to dot symbols

 arch/powerpc/Makefile                | 6 ++++++
 arch/powerpc/boot/Makefile           | 1 +
 arch/powerpc/kernel/exceptions-64e.S | 6 +++---
 arch/powerpc/kernel/head_64.S        | 8 ++++----
 4 files changed, 14 insertions(+), 7 deletions(-)

-- 
2.10.2

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

* [PATCH 1/3] powerpc/64e: convert cmpi to cmpwi in head_64.S
  2016-11-23 13:02 [PATCH 0/3] minor build fixes Nicholas Piggin
@ 2016-11-23 13:02 ` Nicholas Piggin
  2016-11-29 12:58   ` [1/3] " Michael Ellerman
  2016-11-23 13:02 ` [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain Nicholas Piggin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Nicholas Piggin @ 2016-11-23 13:02 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin, Alan Modra, Segher Boessenkool

>From 80f23935cadb ("powerpc: Convert cmp to cmpd in idle enter sequence"):

    PowerPC's "cmp" instruction has four operands. Normally people write
    "cmpw" or "cmpd" for the second cmp operand 0 or 1. But, frequently
    people forget, and write "cmp" with just three operands.

    With older binutils this is silently accepted as if this was "cmpw",
    while often "cmpd" is wanted. With newer binutils GAS will complain
    about this for 64-bit code. For 32-bit code it still silently assumes
    "cmpw" is what is meant.

    In this instance the code comes directly from ISA v2.07, including the
    cmp, but cmpd is correct. Backport to stable so that new toolchains can
    build old kernels.

In this case, cmpwi is called for, so this is just a build fix for
new toolchians.

Stable: v3.0
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/head_64.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 04c546e..1f7f908 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -214,9 +214,9 @@ booting_thread_hwid:
  */
 _GLOBAL(book3e_start_thread)
 	LOAD_REG_IMMEDIATE(r5, MSR_KERNEL)
-	cmpi	0, r3, 0
+	cmpwi	r3, 0
 	beq	10f
-	cmpi	0, r3, 1
+	cmpwi	r3, 1
 	beq	11f
 	/* If the thread id is invalid, just exit. */
 	b	13f
@@ -241,9 +241,9 @@ _GLOBAL(book3e_start_thread)
  * r3 = the thread physical id
  */
 _GLOBAL(book3e_stop_thread)
-	cmpi	0, r3, 0
+	cmpwi	r3, 0
 	beq	10f
-	cmpi	0, r3, 1
+	cmpwi	r3, 1
 	beq	10f
 	/* If the thread id is invalid, just exit. */
 	b	13f
-- 
2.10.2

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

* [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain
  2016-11-23 13:02 [PATCH 0/3] minor build fixes Nicholas Piggin
  2016-11-23 13:02 ` [PATCH 1/3] powerpc/64e: convert cmpi to cmpwi in head_64.S Nicholas Piggin
@ 2016-11-23 13:02 ` Nicholas Piggin
  2016-11-24  9:04   ` Nicholas Piggin
  2016-11-23 13:02 ` [PATCH 3/3] powerpc/64e: don't branch to dot symbols Nicholas Piggin
  2016-11-23 23:03 ` [PATCH 0/3] minor build fixes Alan Modra
  3 siblings, 1 reply; 14+ messages in thread
From: Nicholas Piggin @ 2016-11-23 13:02 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin, Alan Modra

GCC can compile with either endian, but the ABI version always
defaults to the default endian. Alan Modra says:

  you need both -mbig and -mabi=elfv1 to make a powerpc64le gcc
  generate powerpc64 code

The opposite is true for powerpc64 when generating -mlittle it
requires -mabi=elfv2 to generate v2 ABI. This change adds abi
annotations together with endianness.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/Makefile      | 6 ++++++
 arch/powerpc/boot/Makefile | 1 +
 2 files changed, 7 insertions(+)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 617dece..902da6e 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -73,13 +73,17 @@ MULTIPLEWORD	:= -mmultiple
 endif
 
 cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
+cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
 cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
+cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mabi=elfv2
 ifneq ($(cc-name),clang)
   cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mno-strict-align
 endif
 
 aflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
+aflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
 aflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
+aflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mabi=elfv2
 
 ifeq ($(HAS_BIARCH),y)
 override AS	+= -a$(BITS)
@@ -114,6 +118,8 @@ CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-a
 AFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2)
 else
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcall-aixdesc)
+CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
+AFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
 endif
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc))
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mno-pointers-to-nested-functions)
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index eae2dc8..1d50d41 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -33,6 +33,7 @@ BOOTCFLAGS	+= -m64
 endif
 ifdef CONFIG_CPU_BIG_ENDIAN
 BOOTCFLAGS	+= -mbig-endian
+BOOTCFLAGS	+= $(call cc-option,-mabi=elfv1)
 else
 BOOTCFLAGS	+= -mlittle-endian
 BOOTCFLAGS	+= $(call cc-option,-mabi=elfv2)
-- 
2.10.2

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

* [PATCH 3/3] powerpc/64e: don't branch to dot symbols
  2016-11-23 13:02 [PATCH 0/3] minor build fixes Nicholas Piggin
  2016-11-23 13:02 ` [PATCH 1/3] powerpc/64e: convert cmpi to cmpwi in head_64.S Nicholas Piggin
  2016-11-23 13:02 ` [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain Nicholas Piggin
@ 2016-11-23 13:02 ` Nicholas Piggin
  2016-11-29 12:58   ` [3/3] " Michael Ellerman
  2016-11-23 23:03 ` [PATCH 0/3] minor build fixes Alan Modra
  3 siblings, 1 reply; 14+ messages in thread
From: Nicholas Piggin @ 2016-11-23 13:02 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin, Alan Modra

This converts one that was missed by b1576fec7f4d ("powerpc: No need
to use dot symbols when branching to a function").

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/exceptions-64e.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 38a1f96..45b453e 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -923,10 +923,10 @@ kernel_dbg_exc:
 			        PROLOG_ADDITION_NONE)
 	EXCEPTION_COMMON(0x340)
 	addi	r3,r1,STACK_FRAME_OVERHEAD
-	bl	.save_nvgprs
+	bl	save_nvgprs
 	INTS_RESTORE_HARD
-	bl	.unknown_exception
-	b	.ret_from_except
+	bl	unknown_exception
+	b	ret_from_except
 
 /*
  * An interrupt came in while soft-disabled; We mark paca->irq_happened
-- 
2.10.2

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

* Re: [PATCH 0/3] minor build fixes
  2016-11-23 13:02 [PATCH 0/3] minor build fixes Nicholas Piggin
                   ` (2 preceding siblings ...)
  2016-11-23 13:02 ` [PATCH 3/3] powerpc/64e: don't branch to dot symbols Nicholas Piggin
@ 2016-11-23 23:03 ` Alan Modra
  2016-11-24  1:04   ` Nicholas Piggin
  3 siblings, 1 reply; 14+ messages in thread
From: Alan Modra @ 2016-11-23 23:03 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: linuxppc-dev

On Thu, Nov 24, 2016 at 12:02:06AM +1100, Nicholas Piggin wrote:
> I was building BookE and big endian with a little endian cross
> compiler and it stopped working. My BookS BE tests must have been
> building using the ELFv2 ABI. After this, the build sometimes still
> strangely fails with dot symbols in syscall table unable to be found,
> but that's looking like it may be a linker bug (Alan is going to take
> a look).

Yes it is a bug.  In compatibility code that was supposed to handle
mixing old object files that use dot-symbols on function entry with
newer object files that don't.  Here, "old" means mid 2004 or
earlier.

As you can imagine, I'm not hugely concerned about the ld bug..

Since every binutils back to at least 2.17 has the bug, what changed
in the kernel to expose it?  Are you building without -mcall-aixdesc?

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: [PATCH 0/3] minor build fixes
  2016-11-23 23:03 ` [PATCH 0/3] minor build fixes Alan Modra
@ 2016-11-24  1:04   ` Nicholas Piggin
  0 siblings, 0 replies; 14+ messages in thread
From: Nicholas Piggin @ 2016-11-24  1:04 UTC (permalink / raw)
  To: Alan Modra; +Cc: linuxppc-dev

On Thu, 24 Nov 2016 09:33:20 +1030
Alan Modra <amodra@gmail.com> wrote:

> On Thu, Nov 24, 2016 at 12:02:06AM +1100, Nicholas Piggin wrote:
> > I was building BookE and big endian with a little endian cross
> > compiler and it stopped working. My BookS BE tests must have been
> > building using the ELFv2 ABI. After this, the build sometimes still
> > strangely fails with dot symbols in syscall table unable to be found,
> > but that's looking like it may be a linker bug (Alan is going to take
> > a look).  
> 
> Yes it is a bug.  In compatibility code that was supposed to handle
> mixing old object files that use dot-symbols on function entry with
> newer object files that don't.  Here, "old" means mid 2004 or
> earlier.
> 
> As you can imagine, I'm not hugely concerned about the ld bug..
> 
> Since every binutils back to at least 2.17 has the bug, what changed
> in the kernel to expose it?  Are you building without -mcall-aixdesc?
> 

Yeah, it's my attempt to get powerpc64le compiler to build big endian
with -mabi=elfv2, so I'd have missed -mcall-aixdesc somewhere.

Thanks,
Nick

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

* Re: [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain
  2016-11-23 13:02 ` [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain Nicholas Piggin
@ 2016-11-24  9:04   ` Nicholas Piggin
  2016-11-26  3:00     ` Nicholas Piggin
  2016-11-26  7:30     ` Michael Ellerman
  0 siblings, 2 replies; 14+ messages in thread
From: Nicholas Piggin @ 2016-11-24  9:04 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Alan Modra

On Thu, 24 Nov 2016 00:02:08 +1100
Nicholas Piggin <npiggin@gmail.com> wrote:

> GCC can compile with either endian, but the ABI version always
> defaults to the default endian. Alan Modra says:

Okay I was missing mcall-aixdesc, thanks again to Alan for pointing
it out.

This updated patch seems to do better, and it builds BE kernel with
powerpc64le-gcc, and LE with powerpc64-gcc here (I did see a link
failure but then couldn't reproduce it so it might have been a stale
file hanging around somewhere).


From: Nicholas Piggin <npiggin@gmail.com>
Date: Wed, 23 Nov 2016 17:27:39 +1100
Subject: [PATCH] powerpc: allow compilation on cross-endian toolchain

GCC can compile with either endian, but the ABI version always
defaults to the default endian. Alan Modra says:

  you need both -mbig and -mabi=elfv1 to make a powerpc64le gcc
  generate powerpc64 code

The opposite is true for powerpc64 when generating -mlittle it
requires -mabi=elfv2 to generate v2 ABI. This change adds ABI
annotations together with endianness. The kernel with ELFv2 ABI
also uses -mcall-aixdesc, but boot/ does not.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/Makefile      | 7 +++++++
 arch/powerpc/boot/Makefile | 1 +
 2 files changed, 8 insertions(+)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 617dece..8828807 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -73,13 +73,18 @@ MULTIPLEWORD	:= -mmultiple
 endif
 
 cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
+cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
+cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mcall-aixdesc)
 cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
+cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mabi=elfv2
 ifneq ($(cc-name),clang)
   cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mno-strict-align
 endif
 
 aflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
+aflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
 aflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
+aflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mabi=elfv2
 
 ifeq ($(HAS_BIARCH),y)
 override AS	+= -a$(BITS)
@@ -113,7 +118,9 @@ ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
 AFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2)
 else
+CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcall-aixdesc)
+AFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
 endif
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc))
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mno-pointers-to-nested-functions)
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index eae2dc8..1d50d41 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -33,6 +33,7 @@ BOOTCFLAGS	+= -m64
 endif
 ifdef CONFIG_CPU_BIG_ENDIAN
 BOOTCFLAGS	+= -mbig-endian
+BOOTCFLAGS	+= $(call cc-option,-mabi=elfv1)
 else
 BOOTCFLAGS	+= -mlittle-endian
 BOOTCFLAGS	+= $(call cc-option,-mabi=elfv2)
-- 
2.10.2

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

* Re: [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain
  2016-11-24  9:04   ` Nicholas Piggin
@ 2016-11-26  3:00     ` Nicholas Piggin
  2016-11-26  7:30     ` Michael Ellerman
  1 sibling, 0 replies; 14+ messages in thread
From: Nicholas Piggin @ 2016-11-26  3:00 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Alan Modra

On Thu, 24 Nov 2016 20:04:23 +1100
Nicholas Piggin <npiggin@gmail.com> wrote:

> On Thu, 24 Nov 2016 00:02:08 +1100
> Nicholas Piggin <npiggin@gmail.com> wrote:
> 
> > GCC can compile with either endian, but the ABI version always
> > defaults to the default endian. Alan Modra says:  
> 
> Okay I was missing mcall-aixdesc, thanks again to Alan for pointing
> it out.

Final patch here which just slightly changes how the boot code flags
are set (don't introduce unnecessary setting of elfv1 on 32-bit builds).
--

GCC can compile with either endian, but the ABI version always
defaults to the default endian. Alan Modra says:

  you need both -mbig and -mabi=elfv1 to make a powerpc64le gcc
  generate powerpc64 code

The opposite is true for powerpc64 when generating -mlittle it
requires -mabi=elfv2 to generate v2 ABI. This change adds ABI
annotations together with endianness. The kernel with ELFv2 ABI
also uses -mcall-aixdesc, but boot/ does not.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/Makefile      | 7 +++++++
 arch/powerpc/boot/Makefile | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 617dece..8828807 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -73,13 +73,18 @@ MULTIPLEWORD	:= -mmultiple
 endif
 
 cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
+cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
+cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mcall-aixdesc)
 cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
+cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mabi=elfv2
 ifneq ($(cc-name),clang)
   cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mno-strict-align
 endif
 
 aflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
+aflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
 aflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
+aflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mabi=elfv2
 
 ifeq ($(HAS_BIARCH),y)
 override AS	+= -a$(BITS)
@@ -113,7 +118,9 @@ ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
 AFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2)
 else
+CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcall-aixdesc)
+AFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
 endif
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc))
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mno-pointers-to-nested-functions)
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index eae2dc8..7c46cf3 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -28,14 +28,16 @@ BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 		 -isystem $(shell $(CROSS32CC) -print-file-name=include) \
 		 -D$(compress-y)
 
+# PPC64_BOOT_WRAPPER is little-endian specific.
 ifdef CONFIG_PPC64_BOOT_WRAPPER
 BOOTCFLAGS	+= -m64
+BOOTCFLAGS	+= $(call cc-option,-mabi=elfv2)
 endif
+
 ifdef CONFIG_CPU_BIG_ENDIAN
 BOOTCFLAGS	+= -mbig-endian
 else
 BOOTCFLAGS	+= -mlittle-endian
-BOOTCFLAGS	+= $(call cc-option,-mabi=elfv2)
 endif
 
 BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
-- 
2.10.2

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

* Re: [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain
  2016-11-24  9:04   ` Nicholas Piggin
  2016-11-26  3:00     ` Nicholas Piggin
@ 2016-11-26  7:30     ` Michael Ellerman
  2016-11-27  2:46       ` Nicholas Piggin
  1 sibling, 1 reply; 14+ messages in thread
From: Michael Ellerman @ 2016-11-26  7:30 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: Alan Modra

Nicholas Piggin <npiggin@gmail.com> writes:
> On Thu, 24 Nov 2016 00:02:08 +1100
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index 617dece..8828807 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -73,13 +73,18 @@ MULTIPLEWORD	:= -mmultiple
>  endif
>  
>  cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
> +cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
> +cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mcall-aixdesc)

This blew up the world:

  http://kisskb.ellerman.id.au/kisskb/head/1ba4cb3d67e181bdc9a911d7be81f64e3d7597d2/

  Successful:	24% 63/258

I suspect you need to make -mcall-aixdesc 64-bit only.

cheers

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

* Re: [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain
  2016-11-26  7:30     ` Michael Ellerman
@ 2016-11-27  2:46       ` Nicholas Piggin
  2017-02-02  8:08         ` Naveen N. Rao
  2017-03-08  7:25         ` [2/3] " Michael Ellerman
  0 siblings, 2 replies; 14+ messages in thread
From: Nicholas Piggin @ 2016-11-27  2:46 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Alan Modra

On Sat, 26 Nov 2016 18:30:15 +1100
Michael Ellerman <mpe@ellerman.id.au> wrote:

> Nicholas Piggin <npiggin@gmail.com> writes:
> > On Thu, 24 Nov 2016 00:02:08 +1100
> > diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> > index 617dece..8828807 100644
> > --- a/arch/powerpc/Makefile
> > +++ b/arch/powerpc/Makefile
> > @@ -73,13 +73,18 @@ MULTIPLEWORD	:= -mmultiple
> >  endif
> >  
> >  cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
> > +cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
> > +cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mcall-aixdesc)  
> 
> This blew up the world:
> 
>   http://kisskb.ellerman.id.au/kisskb/head/1ba4cb3d67e181bdc9a911d7be81f64e3d7597d2/
> 
>   Successful:	24% 63/258
> 
> I suspect you need to make -mcall-aixdesc 64-bit only.

Yes, I forgot 32-bit will pick those up. 3rd time's a charm, this compiles
64 bit be/le and 32-bit now.

--

Subject: [PATCH] powerpc: allow compilation on cross-endian toolchain

GCC can compile with either endian, but the ABI version always
defaults to the default endian. Alan Modra says:

  you need both -mbig and -mabi=elfv1 to make a powerpc64le gcc
  generate powerpc64 code

The opposite is true for powerpc64 when generating -mlittle it
requires -mabi=elfv2 to generate v2 ABI. This change adds ABI
annotations together with endianness. The kernel with ELFv2 ABI
also uses -mcall-aixdesc, but boot/ does not.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/Makefile      | 11 ++++++++++-
 arch/powerpc/boot/Makefile |  4 +++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 617dece..a60c9c6 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -72,8 +72,15 @@ GNUTARGET	:= powerpc
 MULTIPLEWORD	:= -mmultiple
 endif
 
-cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
+ifdef CONFIG_PPC64
+cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
+cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mcall-aixdesc)
+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
@@ -113,7 +120,9 @@ ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
 AFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2)
 else
+CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcall-aixdesc)
+AFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
 endif
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc))
 CFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mno-pointers-to-nested-functions)
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index eae2dc8..7c46cf3 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -28,14 +28,16 @@ BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 		 -isystem $(shell $(CROSS32CC) -print-file-name=include) \
 		 -D$(compress-y)
 
+# PPC64_BOOT_WRAPPER is little-endian specific.
 ifdef CONFIG_PPC64_BOOT_WRAPPER
 BOOTCFLAGS	+= -m64
+BOOTCFLAGS	+= $(call cc-option,-mabi=elfv2)
 endif
+
 ifdef CONFIG_CPU_BIG_ENDIAN
 BOOTCFLAGS	+= -mbig-endian
 else
 BOOTCFLAGS	+= -mlittle-endian
-BOOTCFLAGS	+= $(call cc-option,-mabi=elfv2)
 endif
 
 BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
-- 
2.10.2

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

* Re: [1/3] powerpc/64e: convert cmpi to cmpwi in head_64.S
  2016-11-23 13:02 ` [PATCH 1/3] powerpc/64e: convert cmpi to cmpwi in head_64.S Nicholas Piggin
@ 2016-11-29 12:58   ` Michael Ellerman
  0 siblings, 0 replies; 14+ messages in thread
From: Michael Ellerman @ 2016-11-29 12:58 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: Nicholas Piggin, Alan Modra

On Wed, 2016-11-23 at 13:02:07 UTC, Nicholas Piggin wrote:
> >From 80f23935cadb ("powerpc: Convert cmp to cmpd in idle enter sequence"):
> 
>     PowerPC's "cmp" instruction has four operands. Normally people write
>     "cmpw" or "cmpd" for the second cmp operand 0 or 1. But, frequently
>     people forget, and write "cmp" with just three operands.
> 
>     With older binutils this is silently accepted as if this was "cmpw",
>     while often "cmpd" is wanted. With newer binutils GAS will complain
>     about this for 64-bit code. For 32-bit code it still silently assumes
>     "cmpw" is what is meant.
> 
>     In this instance the code comes directly from ISA v2.07, including the
>     cmp, but cmpd is correct. Backport to stable so that new toolchains can
>     build old kernels.
> 
> In this case, cmpwi is called for, so this is just a build fix for
> new toolchians.
> 
> Stable: v3.0
> Cc: Segher Boessenkool <segher@kernel.crashing.org>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/f87f253bac3ce4a4eb2a60a1ae604d

cheers

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

* Re: [3/3] powerpc/64e: don't branch to dot symbols
  2016-11-23 13:02 ` [PATCH 3/3] powerpc/64e: don't branch to dot symbols Nicholas Piggin
@ 2016-11-29 12:58   ` Michael Ellerman
  0 siblings, 0 replies; 14+ messages in thread
From: Michael Ellerman @ 2016-11-29 12:58 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: Nicholas Piggin, Alan Modra

On Wed, 2016-11-23 at 13:02:09 UTC, Nicholas Piggin wrote:
> This converts one that was missed by b1576fec7f4d ("powerpc: No need
> to use dot symbols when branching to a function").
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/ae88f7b9af17a1267f5dd5b87a4487

cheers

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

* Re: [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain
  2016-11-27  2:46       ` Nicholas Piggin
@ 2017-02-02  8:08         ` Naveen N. Rao
  2017-03-08  7:25         ` [2/3] " Michael Ellerman
  1 sibling, 0 replies; 14+ messages in thread
From: Naveen N. Rao @ 2017-02-02  8:08 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: Michael Ellerman, linuxppc-dev, Alan Modra

On 2016/11/27 01:46PM, Nicholas Piggin wrote:
> On Sat, 26 Nov 2016 18:30:15 +1100
> Michael Ellerman <mpe@ellerman.id.au> wrote:
> 
> > Nicholas Piggin <npiggin@gmail.com> writes:
> > > On Thu, 24 Nov 2016 00:02:08 +1100
> > > diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> > > index 617dece..8828807 100644
> > > --- a/arch/powerpc/Makefile
> > > +++ b/arch/powerpc/Makefile
> > > @@ -73,13 +73,18 @@ MULTIPLEWORD	:= -mmultiple
> > >  endif
> > >  
> > >  cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
> > > +cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
> > > +cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mcall-aixdesc)  
> > 
> > This blew up the world:
> > 
> >   http://kisskb.ellerman.id.au/kisskb/head/1ba4cb3d67e181bdc9a911d7be81f64e3d7597d2/
> > 
> >   Successful:	24% 63/258
> > 
> > I suspect you need to make -mcall-aixdesc 64-bit only.
> 
> Yes, I forgot 32-bit will pick those up. 3rd time's a charm, this compiles
> 64 bit be/le and 32-bit now.
> 
> --
> 
> Subject: [PATCH] powerpc: allow compilation on cross-endian toolchain
> 
> GCC can compile with either endian, but the ABI version always
> defaults to the default endian. Alan Modra says:
> 
>   you need both -mbig and -mabi=elfv1 to make a powerpc64le gcc
>   generate powerpc64 code
> 
> The opposite is true for powerpc64 when generating -mlittle it
> requires -mabi=elfv2 to generate v2 ABI. This change adds ABI
> annotations together with endianness. The kernel with ELFv2 ABI
> also uses -mcall-aixdesc, but boot/ does not.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

FWIW, this fixes the issue with vmx build when doing a BE build with LE 
toolchain:
	/tmp/ccR5lr0U.s: Error: .size expression for aes_p8_set_encrypt_key does not evaluate to a constant
	/tmp/ccR5lr0U.s: Error: .size expression for .aes_p8_set_encrypt_key does not evaluate to a constant
	/tmp/ccR5lr0U.s: Error: .size expression for aes_p8_set_decrypt_key does not evaluate to a constant
	/tmp/ccR5lr0U.s: Error: .size expression for .aes_p8_set_decrypt_key does not evaluate to a constant
	/tmp/ccR5lr0U.s: Error: .size expression for aes_p8_encrypt does not evaluate to a constant
	/tmp/ccR5lr0U.s: Error: .size expression for .aes_p8_encrypt does not evaluate to a constant

Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

Thanks,
Naveen

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

* Re: [2/3] powerpc: allow compilation on cross-endian toolchain
  2016-11-27  2:46       ` Nicholas Piggin
  2017-02-02  8:08         ` Naveen N. Rao
@ 2017-03-08  7:25         ` Michael Ellerman
  1 sibling, 0 replies; 14+ messages in thread
From: Michael Ellerman @ 2017-03-08  7:25 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: linuxppc-dev, Alan Modra

On Sun, 2016-11-27 at 02:46:20 UTC, Nicholas Piggin wrote:
> Subject: [PATCH] powerpc: allow compilation on cross-endian toolchain
> 
> GCC can compile with either endian, but the ABI version always
> defaults to the default endian. Alan Modra says:
> 
>   you need both -mbig and -mabi=elfv1 to make a powerpc64le gcc
>   generate powerpc64 code
> 
> The opposite is true for powerpc64 when generating -mlittle it
> requires -mabi=elfv2 to generate v2 ABI. This change adds ABI
> annotations together with endianness. The kernel with ELFv2 ABI
> also uses -mcall-aixdesc, but boot/ does not.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/4dc831aa88132f835cefe876aa0206

cheers

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

end of thread, other threads:[~2017-03-08  7:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-23 13:02 [PATCH 0/3] minor build fixes Nicholas Piggin
2016-11-23 13:02 ` [PATCH 1/3] powerpc/64e: convert cmpi to cmpwi in head_64.S Nicholas Piggin
2016-11-29 12:58   ` [1/3] " Michael Ellerman
2016-11-23 13:02 ` [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain Nicholas Piggin
2016-11-24  9:04   ` Nicholas Piggin
2016-11-26  3:00     ` Nicholas Piggin
2016-11-26  7:30     ` Michael Ellerman
2016-11-27  2:46       ` Nicholas Piggin
2017-02-02  8:08         ` Naveen N. Rao
2017-03-08  7:25         ` [2/3] " Michael Ellerman
2016-11-23 13:02 ` [PATCH 3/3] powerpc/64e: don't branch to dot symbols Nicholas Piggin
2016-11-29 12:58   ` [3/3] " Michael Ellerman
2016-11-23 23:03 ` [PATCH 0/3] minor build fixes Alan Modra
2016-11-24  1:04   ` Nicholas Piggin

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.