Skip to contentSkip to conversation

minor build fixes

PATCH Applied Nicholas Piggin 5 participants 14 messages Nov 23, 2016 – Mar 8, 2017 PowerPC

lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

cover minor build fixes

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(-)
Signature · 1 line
2.10.2
author reviewer
#1 lore raw

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

Quoted 1 line

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 <[email protected]>
---
 arch/powerpc/kernel/head_64.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/kernel/head_64.S +4 -4
index 04c546e..1f7f908 100644
@@ -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
Signature · 1 line
2.10.2
#2 lore raw

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

Quoted 15 lines · Nicholas Piggin
Quoted 1 line

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.

Quoted 6 lines

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

Stable: v3.0

Cc Segher Boessenkool <[email protected]>

Applied to powerpc next, thanks.

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

cheers

author reviewer
#3 lore raw

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

In reply to Nicholas Piggin

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.

---
 arch/powerpc/Makefile      | 6 ++++++
 arch/powerpc/boot/Makefile | 1 +
 2 files changed, 7 insertions(+)
arch/powerpc/Makefile +6 -0
index 617dece..902da6e 100644
@@ -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)
arch/powerpc/boot/Makefile +1 -0
index eae2dc8..1d50d41 100644
@@ -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)
Signature · 1 line
2.10.2
author reviewer
#4 lore raw

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

Quoted 2 lines · On Thu, 24 Nov 2016 00:02:08 +1100 Nicholas Piggin <[email protected]> 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 <[email protected]>
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.

---
 arch/powerpc/Makefile      | 7 +++++++
 arch/powerpc/boot/Makefile | 1 +
 2 files changed, 8 insertions(+)
arch/powerpc/Makefile +7 -0
index 617dece..8828807 100644
@@ -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)
arch/powerpc/boot/Makefile +1 -0
index eae2dc8..1d50d41 100644
@@ -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)
Signature · 1 line
2.10.2
author reviewer
#5 lore raw

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

Quoted 8 lines · On Thu, 24 Nov 2016 20:04:23 +1100 Nicholas Piggin <[email protected]> wrote:
Quoted 2 lines · On Thu, 24 Nov 2016 00:02:08 +1100 Nicholas Piggin <[email protected]> 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.

---
 arch/powerpc/Makefile      | 7 +++++++
 arch/powerpc/boot/Makefile | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)
arch/powerpc/Makefile +7 -0
index 617dece..8828807 100644
@@ -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)
arch/powerpc/boot/Makefile +3 -1
index eae2dc8..7c46cf3 100644
@@ -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
Signature · 1 line
2.10.2
#6 lore raw

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

In reply to Nicholas Piggin

arch/powerpc/Makefile MULTIPLEWORD := -mmultiple · line 77

Quoted 11 lines · Nicholas Piggin

On Thu, 24 Nov 2016 00:02:08 +1100

arch/powerpc/Makefile +2 -0
index 617dece..8828807 100644
@@ -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

author reviewer
#7 lore raw

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

Quoted 15 lines · On Sat, 26 Nov 2016 18:30:15 +1100 Michael Ellerman <[email protected]> wrote:

arch/powerpc/Makefile MULTIPLEWORD := -mmultiple · line 77

Quoted 11 lines · Nicholas Piggin

On Thu, 24 Nov 2016 00:02:08 +1100

arch/powerpc/Makefile +2 -0
index 617dece..8828807 100644
@@ -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:

Quoted 5 lines

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.

---
 arch/powerpc/Makefile      | 11 ++++++++++-
 arch/powerpc/boot/Makefile |  4 +++-
 2 files changed, 13 insertions(+), 2 deletions(-)
arch/powerpc/Makefile +10 -1
index 617dece..a60c9c6 100644
@@ -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)
arch/powerpc/boot/Makefile +3 -1
index eae2dc8..7c46cf3 100644
@@ -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
Signature · 1 line
2.10.2
Tested-by
#8 lore raw

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

Quoted 37 lines · Nicholas Piggin
Quoted 15 lines · On Sat, 26 Nov 2016 18:30:15 +1100 Michael Ellerman <[email protected]> wrote:

arch/powerpc/Makefile MULTIPLEWORD := -mmultiple · line 77

Quoted 11 lines · Nicholas Piggin

On Thu, 24 Nov 2016 00:02:08 +1100

arch/powerpc/Makefile +2 -0
index 617dece..8828807 100644
@@ -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:

Quoted 5 lines

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

Quoted 6 lines

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.

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

Thanks,
Naveen

#9 lore raw

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

In reply to Nicholas Piggin
Quoted 8 lines · Nicholas Piggin

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

Quoted 6 lines

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.

Applied to powerpc fixes, thanks.

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

cheers

author reviewer
#10 lore raw

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

In reply to Nicholas Piggin

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

---
 arch/powerpc/kernel/exceptions-64e.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/exceptions-64e.S +3 -3
index 38a1f96..45b453e 100644
@@ -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
Signature · 1 line
2.10.2
#12 lore raw
In reply to Nicholas Piggin
Quoted 6 lines · Nicholas Piggin

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?

Signature · 2 lines
Alan Modra
Australia Development Lab, IBM
author reviewer
#13 lore raw
Quoted 13 lines · On Thu, 24 Nov 2016 09:33:20 +1030 Alan Modra <[email protected]> wrote:
Quoted 6 lines · Nicholas Piggin

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.

Quoted 5 lines

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