[PATCH 0/3] minor build fixes

STALE3438d

14 messages, 5 authors, 2017-03-08 · open the first message on its own page

[PATCH 0/3] minor build fixes

From: Nicholas Piggin <npiggin@gmail.com>
Date: 2016-11-23 13:02:26

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

[PATCH 1/3] powerpc/64e: convert cmpi to cmpwi in head_64.S

From: Nicholas Piggin <npiggin@gmail.com>
Date: 2016-11-23 13:02:31

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

[PATCH 2/3] powerpc: allow compilation on cross-endian toolchain

From: Nicholas Piggin <npiggin@gmail.com>
Date: 2016-11-23 13:02:34

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

[PATCH 3/3] powerpc/64e: don't branch to dot symbols

From: Nicholas Piggin <npiggin@gmail.com>
Date: 2016-11-23 13:02:37

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

Re: [PATCH 0/3] minor build fixes

From: Alan Modra <hidden>
Date: 2016-11-23 23:03:27

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

Re: [PATCH 0/3] minor build fixes

From: Nicholas Piggin <npiggin@gmail.com>
Date: 2016-11-24 01:04:55

On Thu, 24 Nov 2016 09:33:20 +1030
Alan Modra [off-list ref] wrote:
On Thu, Nov 24, 2016 at 12:02:06AM +1100, Nicholas Piggin wrote:
quoted
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

Re: [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain

From: Nicholas Piggin <npiggin@gmail.com>
Date: 2016-11-24 09:04:35

On Thu, 24 Nov 2016 00:02:08 +1100
Nicholas Piggin [off-list ref] 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

Re: [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain

From: Nicholas Piggin <npiggin@gmail.com>
Date: 2016-11-26 03:00:19

On Thu, 24 Nov 2016 20:04:23 +1100
Nicholas Piggin [off-list ref] wrote:
On Thu, 24 Nov 2016 00:02:08 +1100
Nicholas Piggin [off-list ref] wrote:
quoted
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

Re: [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-11-26 07:30:18

Nicholas Piggin [off-list ref] writes:
quoted hunk
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

Re: [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain

From: Nicholas Piggin <npiggin@gmail.com>
Date: 2016-11-27 02:46:39

On Sat, 26 Nov 2016 18:30:15 +1100
Michael Ellerman [off-list ref] wrote:
Nicholas Piggin [off-list ref] writes:
quoted
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

Re: [1/3] powerpc/64e: convert cmpi to cmpwi in head_64.S

From: Michael Ellerman <hidden>
Date: 2016-11-29 12:58:11

On Wed, 2016-11-23 at 13:02:07 UTC, Nicholas Piggin wrote:
quoted
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 <redacted>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Applied to powerpc next, thanks.

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

cheers

Re: [3/3] powerpc/64e: don't branch to dot symbols

From: Michael Ellerman <hidden>
Date: 2016-11-29 12:58:15

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

Re: [PATCH 2/3] powerpc: allow compilation on cross-endian toolchain

From: Naveen N. Rao <hidden>
Date: 2017-02-02 08:08:37

On 2016/11/27 01:46PM, Nicholas Piggin wrote:
On Sat, 26 Nov 2016 18:30:15 +1100
Michael Ellerman [off-list ref] wrote:
quoted
Nicholas Piggin [off-list ref] writes:
quoted
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 <redacted>

Thanks,
Naveen

Re: [2/3] powerpc: allow compilation on cross-endian toolchain

From: Michael Ellerman <hidden>
Date: 2017-03-08 07:25:46

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help