Skip to contentSkip to conversation

Remaining ARM cross compile patches

PATCH In review Ian Campbell 3 participants 8 messages Apr 26, 2013 – Jul 19, 2013

lore
Share & tools
lore
#0 lore raw

cover Remaining ARM cross compile patches

One of these got missed somehow when I put the xenctx series together. The other is new and fixes cross compiling the arm64 hypervisor in the environment described at
http://wiki.xen.org/wiki/Xen_ARM_with_Virtualization_Extensions/CrossCompiling

There is one remaining wrinkle which is this libc bug:
https://bugs.launchpad.net/linaro-aarch64/+bug/1169164

Which can be worked around with:

xen/include/public/arch-arm.h +10 -0
index 2f5ce18..d1753d8 100644
@@ -219,6 +219,16 @@ typedef uint64_t xen_callback_t;
 
 /* 64 bit modes */
 #ifdef __aarch64__
+
+#undef PSR_MODE_BIT
+#undef PSR_MODE_EL3h
+#undef PSR_MODE_EL3t
+#undef PSR_MODE_EL2h
+#undef PSR_MODE_EL2t
+#undef PSR_MODE_EL1h
+#undef PSR_MODE_EL1t
+#undef PSR_MODE_EL0t
+
 #define PSR_MODE_BIT  0x10 /* Set iff AArch32 */
 #define PSR_MODE_EL3h 0x0d
 #define PSR_MODE_EL3t 0x0c

Ian

#1 lore raw

PATCH 1/2 xen: arm: correct platform detection in public header.

These headers cannot use the CONFIG_FOO defines provided when building Xen (since they aren't provided when building tools or by external components) and need to use the compiler provided architecture defines.

This manifested itself as a failure to build xenctx.c on ARM64 due to the missing symbols contains .

---
 xen/include/public/arch-arm.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
xen/include/public/arch-arm.h +1 -1
index 746df8e..2f5ce18 100644
@@ -218,7 +218,7 @@ typedef uint64_t xen_callback_t;
 #define PSR_MODE_SYS 0x1f
 
 /* 64 bit modes */
-#ifdef CONFIG_ARM_64
+#ifdef __aarch64__
 #define PSR_MODE_BIT  0x10 /* Set iff AArch32 */
 #define PSR_MODE_EL3h 0x0d
 #define PSR_MODE_EL3t 0x0c
Signature · 1 line
1.7.2.5
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] xen: arm: correct platform detection in public header.

Quoted 8 lines · Ian Campbell

These headers cannot use the CONFIG_FOO defines provided when building Xen (since they aren't provided when building tools or by external components) and need to use the compiler provided architecture defines.

This manifested itself as a failure to build xenctx.c on ARM64 due to the missing symbols contains .

Quoted 19 lines
 xen/include/public/arch-arm.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
xen/include/public/arch-arm.h +1 -1
index 746df8e..2f5ce18 100644
@@ -218,7 +218,7 @@ typedef uint64_t xen_callback_t;
 #define PSR_MODE_SYS 0x1f
 
 /* 64 bit modes */
-#ifdef CONFIG_ARM_64
+#ifdef __aarch64__
 #define PSR_MODE_BIT  0x10 /* Set iff AArch32 */
 #define PSR_MODE_EL3h 0x0d
 #define PSR_MODE_EL3t 0x0c
Signature · 1 line
1.7.2.5
author Applied
#3 lore raw

Re: [PATCH 1/2] xen: arm: correct platform detection in public header.

Quoted 11 lines · Stefano Stabellini
Quoted 8 lines · Ian Campbell

These headers cannot use the CONFIG_FOO defines provided when building Xen (since they aren't provided when building tools or by external components) and need to use the compiler provided architecture defines.

This manifested itself as a failure to build xenctx.c on ARM64 due to the missing symbols contains .

Applied, thanks.

#4 lore raw

PATCH 2/2 xen: arm: drop LDFLAGS_DIRECT emulation specification.

In reply to Ian Campbell

The current -maarch64elf fails when cross-building arm64 on Ubuntu Raring due to a missing file "ldscripts/aarch64elf.xr". This is undoubtedly an Ubuntu gcc bug, hwever when investigating I found that this option was not necessary at all since we provide an explicit linker script when linking the hypervisor (AFAICT all -m<foo> does is override the default linker script).

LDFLAGS_DIRECT is also used when linking the intermediate built-in.o files but -m<emulatin> is not needed for this since it isn't linking the final image and we are calling the linker with the correct, cross if necessary, name.

However it does appear to be potentially useful to supply -EL in both cases to ensure that we get little endian images. (I just happened to spot that Linux does this, for both arm and arm64, although I expect we are unlikely to trip over such toolchains these days).

Tested with cross-builds of arm32 and arm64 as well as a native arm32 build.

---
 config/arm32.mk |    5 +----
 config/arm64.mk |    2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)
config/arm32.mk +1 -4
index f64f0c1..683531c 100644
@@ -10,9 +10,6 @@ CFLAGS += -marm
 HAS_PL011 := y
 
 # Use only if calling $(LD) directly.
-#LDFLAGS_DIRECT_OpenBSD = _obsd
-#LDFLAGS_DIRECT_FreeBSD = _fbsd
-LDFLAGS_DIRECT_Linux = _linux
-LDFLAGS_DIRECT += -marmelf$(LDFLAGS_DIRECT_$(XEN_OS))_eabi
+LDFLAGS_DIRECT += -EL
 
 CONFIG_LOAD_ADDRESS ?= 0x80000000
config/arm64.mk +1 -1
index b2457eb..55b16da 100644
@@ -7,6 +7,6 @@ CFLAGS += #-marm -march= -mcpu= etc
 HAS_PL011 := y
 
 # Use only if calling $(LD) directly.
-LDFLAGS_DIRECT += -maarch64elf
+LDFLAGS_DIRECT += -EL
 
 CONFIG_LOAD_ADDRESS ?= 0x80000000
Signature · 1 line
1.7.2.5
#5 lore raw

Re: [PATCH 2/2] xen: arm: drop LDFLAGS_DIRECT emulation specification.

Ping?

Quoted 50 lines · Ian Campbell

The current -maarch64elf fails when cross-building arm64 on Ubuntu Raring due to a missing file "ldscripts/aarch64elf.xr". This is undoubtedly an Ubuntu gcc bug, hwever when investigating I found that this option was not necessary at all since we provide an explicit linker script when linking the hypervisor (AFAICT all -m<foo> does is override the default linker script).

LDFLAGS_DIRECT is also used when linking the intermediate built-in.o files but -m<emulatin> is not needed for this since it isn't linking the final image and we are calling the linker with the correct, cross if necessary, name.

However it does appear to be potentially useful to supply -EL in both cases to ensure that we get little endian images. (I just happened to spot that Linux does this, for both arm and arm64, although I expect we are unlikely to trip over such toolchains these days).

Tested with cross-builds of arm32 and arm64 as well as a native arm32 build.

---
 config/arm32.mk |    5 +----
 config/arm64.mk |    2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)
config/arm32.mk +1 -4
index f64f0c1..683531c 100644
@@ -10,9 +10,6 @@ CFLAGS += -marm
 HAS_PL011 := y
 
 # Use only if calling $(LD) directly.
-#LDFLAGS_DIRECT_OpenBSD = _obsd
-#LDFLAGS_DIRECT_FreeBSD = _fbsd
-LDFLAGS_DIRECT_Linux = _linux
-LDFLAGS_DIRECT += -marmelf$(LDFLAGS_DIRECT_$(XEN_OS))_eabi
+LDFLAGS_DIRECT += -EL
 
 CONFIG_LOAD_ADDRESS ?= 0x80000000
config/arm64.mk +1 -1
index b2457eb..55b16da 100644
@@ -7,6 +7,6 @@ CFLAGS += #-marm -march= -mcpu= etc
 HAS_PL011 := y
 
 # Use only if calling $(LD) directly.
-LDFLAGS_DIRECT += -maarch64elf
+LDFLAGS_DIRECT += -EL
 
 CONFIG_LOAD_ADDRESS ?= 0x80000000
Acked-by
#6 lore raw

Re: [PATCH 2/2] xen: arm: drop LDFLAGS_DIRECT emulation specification.

Quoted 21 lines · Ian Campbell

Ping?

Quoted 18 lines · Ian Campbell

The current -maarch64elf fails when cross-building arm64 on Ubuntu Raring due to a missing file "ldscripts/aarch64elf.xr". This is undoubtedly an Ubuntu gcc bug, hwever when investigating I found that this option was not necessary at all since we provide an explicit linker script when linking the hypervisor (AFAICT all -m<foo> does is override the default linker script).

LDFLAGS_DIRECT is also used when linking the intermediate built-in.o files but -m<emulatin> is not needed for this since it isn't linking the final image and we are calling the linker with the correct, cross if necessary, name.

However it does appear to be potentially useful to supply -EL in both cases to ensure that we get little endian images. (I just happened to spot that Linux does this, for both arm and arm64, although I expect we are unlikely to trip over such toolchains these days).

Tested with cross-builds of arm32 and arm64 as well as a native arm32 build.

author Applied
#7 lore raw

Re: [PATCH 2/2] xen: arm: drop LDFLAGS_DIRECT emulation specification.

Quoted 19 lines · Tim Deegan
Quoted 18 lines · Ian Campbell

Ping?

Quoted 15 lines · Ian Campbell

The current -maarch64elf fails when cross-building arm64 on Ubuntu Raring due to a missing file "ldscripts/aarch64elf.xr". This is undoubtedly an Ubuntu gcc bug, hwever when investigating I found that this option was not necessary at all since we provide an explicit linker script when linking the hypervisor (AFAICT all -m<foo> does is override the default linker script).

LDFLAGS_DIRECT is also used when linking the intermediate built-in.o files but -m<emulatin> is not needed for this since it isn't linking the final image and we are calling the linker with the correct, cross if necessary, name.

However it does appear to be potentially useful to supply -EL in both cases to ensure that we get little endian images. (I just happened to spot that Linux does this, for both arm and arm64, although I expect we are unlikely to trip over such toolchains these days).

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

Tested with cross-builds of arm32 and arm64 as well as a native arm32 build.

Applied, thanks.