Skip to contentSkip to conversation

ARM cross-compile build fix

PATCH Razvan Cojocaru 2 participants 2 messages Sep 7, 2016

lore
Share & tools
lore
#0 lore raw

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:

xen/include/public/arch-arm.h +14 -0
index 870bc3b..e4560a5 100644
@@ -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.

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#1 lore raw
Quoted 1 line · Razvan Cojocaru

Hello,

Hello Razvan,

Quoted 45 lines

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:

xen/include/public/arch-arm.h +14 -0
index 870bc3b..e4560a5 100644
@@ -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)

Quoted 3 lines

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,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel