On Wed, Oct 25, 2017 at 05:04:10PM +0200, Mark Kettenis wrote:
> The clang 5.0.0 integrated assembler seems to be a little bit more
> fussy and doesn't allow the use of the "smc" instructions without
> declaring that you want to use the TrustZone architecture extension.
> Unfortunately our binutils assembler doesn't recognize the pseudo-op.
> So this diff wraps it into an #ifdef.
> 
> ok?

It seems it is in binutils since 2.21
https://gcc.gnu.org/ml/gcc-help/2012-07/msg00180.html

Too bad the test can't be against a binutils version.

hvc also requires an .arch_extension line when used without .word

The other option would be to build the kernel with -march=armv7ve
when not building gcc4 which enables
'FeatureTrustZone, FeatureMP, FeatureVirtualization' but that
might creep into places where it shouldn't.

Index: armv7/armv7_start.S
===================================================================
RCS file: /cvs/src/sys/arch/armv7/armv7/armv7_start.S,v
retrieving revision 1.14
diff -u -p -r1.14 armv7_start.S
--- armv7/armv7_start.S 14 Jun 2017 13:12:49 -0000      1.14
+++ armv7/armv7_start.S 25 Oct 2017 15:53:24 -0000
@@ -38,7 +38,13 @@
 #undef DOMAIN_CLIENT   /* XXX */
 #include "assym.h"
 
+#ifdef __clang__
+.arch_extension sec
+.arch_extension virt
+#define HVC    hvc     #0
+#else
 #define HVC    .word   0xe1400070              @ hvc
+#endif
 
        .text
 

Reply via email to