arm: Check for the .arch directive in configure

Message ID 1493882767-16423-1-git-send-email-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö May 4, 2017, 7:26 a.m.
When targeting windows, the .arch directive isn't available.

So far, when building for windows, we've always used gas-preprocessor,
both when using msvc's armasm and when using clang. Lately, clang/llvm
has implemented the last missing piece (altmacro support) for building
our assembly without gas-preprocessor. This means that we now build
for arm/windows with clang without any extra compatibility layer.
---
 configure           |  4 ++++
 libavutil/arm/asm.S | 14 ++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

Patch

diff --git a/configure b/configure
index c7d0363..029ae9e 100755
--- a/configure
+++ b/configure
@@ -1661,6 +1661,7 @@  SYSTEM_FUNCS="
 "
 
 TOOLCHAIN_FEATURES="
+    as_arch_directive
     as_dn_directive
     as_fpu_directive
     as_func
@@ -4372,6 +4373,9 @@  EOF
 
     check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
 
+    check_as <<EOF && enable as_arch_directive
+.arch armv7-a
+EOF
     check_as <<EOF && enable as_dn_directive
 ra .dn d0.i16
 .unreq ra
diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index a791e80..efc26f5 100644
--- a/libavutil/arm/asm.S
+++ b/libavutil/arm/asm.S
@@ -40,6 +40,12 @@ 
 #   define FUNC @
 #endif
 
+#if HAVE_AS_ARCH_DIRECTIVE
+#   define ARCH
+#else
+#   define ARCH @
+#endif
+
 #if HAVE_AS_FPU_DIRECTIVE
 #   define FPU
 #else
@@ -47,13 +53,13 @@ 
 #endif
 
 #if   HAVE_NEON
-        .arch           armv7-a
+ARCH    .arch           armv7-a
 #elif HAVE_ARMV6T2
-        .arch           armv6t2
+ARCH    .arch           armv6t2
 #elif HAVE_ARMV6
-        .arch           armv6
+ARCH    .arch           armv6
 #elif HAVE_ARMV5TE
-        .arch           armv5te
+ARCH    .arch           armv5te
 #endif
 #if   HAVE_AS_OBJECT_ARCH
 ELF     .object_arch    armv4