diff mbox

ARM cross-compile build fix

Message ID 4829a7fd-8f8f-4b92-ebec-1264c333f47e@bitdefender.com (mailing list archive)
State New, archived
Headers show

Commit Message

Razvan Cojocaru Sept. 7, 2016, 8:24 a.m. UTC
Hello,

The fastest way to compile-check the patches that touch ARM bits is to
simply cross-compile, and I've followed the instructions here:

https://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions/CrossCompiling#64-bit_crossbuild

However, there was an error trying to build master, several macros were
redefined in arch-arm.h (originally defined in ptrace.h). The following
patch has fixed the problem for me, but it's rather crude:

 #define PSR_GUEST64_INIT
(PSR_ABT_MASK|PSR_FIQ_MASK|PSR_IRQ_MASK|PSR_MODE_EL1h)

I'm not sure this is the right fix, which is why I didn't send the patch
for review the usual way, but I hope it's helpful. Please let me know if
you'd like me to send a proper patch.


Thanks,
Razvan

Comments

Julien Grall Sept. 7, 2016, 8:46 a.m. UTC | #1
On 07/09/2016 09:24, Razvan Cojocaru wrote:
> Hello,

Hello Razvan,

>
> The fastest way to compile-check the patches that touch ARM bits is to
> simply cross-compile, and I've followed the instructions here:
>
> https://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions/CrossCompiling#64-bit_crossbuild
>
> However, there was an error trying to build master, several macros were
> redefined in arch-arm.h (originally defined in ptrace.h). The following
> patch has fixed the problem for me, but it's rather crude:
>
> diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
> index 870bc3b..e4560a5 100644
> --- a/xen/include/public/arch-arm.h
> +++ b/xen/include/public/arch-arm.h
> @@ -362,13 +362,27 @@ typedef uint64_t xen_callback_t;
>
>  /* 64 bit modes */
>  #define PSR_MODE_BIT  0x10 /* Set iff AArch32 */
> +#ifndef PSR_MODE_EL3h
>  #define PSR_MODE_EL3h 0x0d
> +#endif
> +#ifndef PSR_MODE_EL3t
>  #define PSR_MODE_EL3t 0x0c
> +#endif
> +#ifndef PSR_MODE_EL2h
>  #define PSR_MODE_EL2h 0x09
> +#endif
> +#ifndef PSR_MODE_EL2t
>  #define PSR_MODE_EL2t 0x08
> +#endif
> +#ifndef PSR_MODE_EL1h
>  #define PSR_MODE_EL1h 0x05
> +#endif
> +#ifndef PSR_MODE_EL1t
>  #define PSR_MODE_EL1t 0x04
> +#endif
> +#ifndef PSR_MODE_EL0t
>  #define PSR_MODE_EL0t 0x00
> +#endif
>
>  #define PSR_GUEST32_INIT
> (PSR_ABT_MASK|PSR_FIQ_MASK|PSR_IRQ_MASK|PSR_MODE_SVC)
>  #define PSR_GUEST64_INIT
> (PSR_ABT_MASK|PSR_FIQ_MASK|PSR_IRQ_MASK|PSR_MODE_EL1h)
>
> I'm not sure this is the right fix, which is why I didn't send the patch
> for review the usual way, but I hope it's helpful. Please let me know if
> you'd like me to send a proper patch.

This is a glibc bug and is already documented on the wiki:
https://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions#error:_.22PSR_MODE_EL3h.22_redefined

Cheers,
diff mbox

Patch

diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index 870bc3b..e4560a5 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -362,13 +362,27 @@  typedef uint64_t xen_callback_t;

 /* 64 bit modes */
 #define PSR_MODE_BIT  0x10 /* Set iff AArch32 */
+#ifndef PSR_MODE_EL3h
 #define PSR_MODE_EL3h 0x0d
+#endif
+#ifndef PSR_MODE_EL3t
 #define PSR_MODE_EL3t 0x0c
+#endif
+#ifndef PSR_MODE_EL2h
 #define PSR_MODE_EL2h 0x09
+#endif
+#ifndef PSR_MODE_EL2t
 #define PSR_MODE_EL2t 0x08
+#endif
+#ifndef PSR_MODE_EL1h
 #define PSR_MODE_EL1h 0x05
+#endif
+#ifndef PSR_MODE_EL1t
 #define PSR_MODE_EL1t 0x04
+#endif
+#ifndef PSR_MODE_EL0t
 #define PSR_MODE_EL0t 0x00
+#endif

 #define PSR_GUEST32_INIT
(PSR_ABT_MASK|PSR_FIQ_MASK|PSR_IRQ_MASK|PSR_MODE_SVC)