arm: Check for support for the .fpu directive

Message ID 1468926594-17307-1-git-send-email-martin@martin.st
State Committed
Commit 6f9e34baea4f6f484392e4e67f606a0835d07b73
Headers show

Commit Message

Martin Storsjö July 19, 2016, 11:09 a.m.
When targeting COFF (windows), clang doesn't support this
directive (while binutils supports it for all targets).
---
 configure                     |  4 ++++
 libavutil/arm/asm.S           | 10 ++++++++--
 tests/checkasm/arm/checkasm.S |  2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)

Comments

Luca Barbato July 19, 2016, 1:47 p.m. | #1
On 19/07/16 13:09, Martin Storsjö wrote:
> When targeting COFF (windows), clang doesn't support this
> directive (while binutils supports it for all targets).
> ---
>  configure                     |  4 ++++
>  libavutil/arm/asm.S           | 10 ++++++++--
>  tests/checkasm/arm/checkasm.S |  2 +-
>  3 files changed, 13 insertions(+), 3 deletions(-)
> 

Probably OK.

lu
Janne Grunau July 19, 2016, 5:47 p.m. | #2
On 2016-07-19 14:09:54 +0300, Martin Storsjö wrote:
> When targeting COFF (windows), clang doesn't support this
> directive (while binutils supports it for all targets).
> ---
>  configure                     |  4 ++++
>  libavutil/arm/asm.S           | 10 ++++++++--
>  tests/checkasm/arm/checkasm.S |  2 +-
>  3 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index ce52f50..37c5611 100755
> --- a/configure
> +++ b/configure
> @@ -1597,6 +1597,7 @@ SYSTEM_FUNCS="
>  
>  TOOLCHAIN_FEATURES="
>      as_dn_directive
> +    as_fpu_directive
>      as_func
>      as_object_arch
>      asm_mod_q
> @@ -4243,6 +4244,9 @@ EOF
>  ra .dn d0.i16
>  .unreq ra
>  EOF
> +    check_as <<EOF && enable as_fpu_directive
> +.fpu neon
> +EOF
>  
>      # llvm's integrated assembler supports .object_arch from llvm 3.5
>      [ "$objformat" = elf ] && check_as <<EOF && enable as_object_arch
> diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
> index 943c1ce..1a048b5 100644
> --- a/libavutil/arm/asm.S
> +++ b/libavutil/arm/asm.S
> @@ -40,6 +40,12 @@
>  #   define FUNC @
>  #endif
>  
> +#if HAVE_AS_FPU_DIRECTIVE
> +#   define FPU
> +#else
> +#   define FPU @
> +#endif
> +
>  #if   HAVE_NEON
>          .arch           armv7-a
>  #elif HAVE_ARMV6T2
> @@ -54,11 +60,11 @@ ELF     .object_arch    armv4
>  #endif
>  
>  #if   HAVE_NEON
> -        .fpu            neon
> +FPU     .fpu            neon
>  ELF     .eabi_attribute 10, 0           @ suppress Tag_FP_arch
>  ELF     .eabi_attribute 12, 0           @ suppress Tag_Advanced_SIMD_arch
>  #elif HAVE_VFP
> -        .fpu            vfp
> +FPU     .fpu            vfp
>  ELF     .eabi_attribute 10, 0           @ suppress Tag_FP_arch
>  #endif
>  
> diff --git a/tests/checkasm/arm/checkasm.S b/tests/checkasm/arm/checkasm.S
> index ab53d0a..098f22e 100644
> --- a/tests/checkasm/arm/checkasm.S
> +++ b/tests/checkasm/arm/checkasm.S
> @@ -24,7 +24,7 @@
>  
>  /* override fpu so that NEON instructions are rejected */
>  #if HAVE_VFP
> -.fpu            vfp
> +FPU     .fpu            vfp
>  ELF     .eabi_attribute 10, 0           @ suppress Tag_FP_arch
>  #endif
>  

ok

Janne

Patch

diff --git a/configure b/configure
index ce52f50..37c5611 100755
--- a/configure
+++ b/configure
@@ -1597,6 +1597,7 @@  SYSTEM_FUNCS="
 
 TOOLCHAIN_FEATURES="
     as_dn_directive
+    as_fpu_directive
     as_func
     as_object_arch
     asm_mod_q
@@ -4243,6 +4244,9 @@  EOF
 ra .dn d0.i16
 .unreq ra
 EOF
+    check_as <<EOF && enable as_fpu_directive
+.fpu neon
+EOF
 
     # llvm's integrated assembler supports .object_arch from llvm 3.5
     [ "$objformat" = elf ] && check_as <<EOF && enable as_object_arch
diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index 943c1ce..1a048b5 100644
--- a/libavutil/arm/asm.S
+++ b/libavutil/arm/asm.S
@@ -40,6 +40,12 @@ 
 #   define FUNC @
 #endif
 
+#if HAVE_AS_FPU_DIRECTIVE
+#   define FPU
+#else
+#   define FPU @
+#endif
+
 #if   HAVE_NEON
         .arch           armv7-a
 #elif HAVE_ARMV6T2
@@ -54,11 +60,11 @@  ELF     .object_arch    armv4
 #endif
 
 #if   HAVE_NEON
-        .fpu            neon
+FPU     .fpu            neon
 ELF     .eabi_attribute 10, 0           @ suppress Tag_FP_arch
 ELF     .eabi_attribute 12, 0           @ suppress Tag_Advanced_SIMD_arch
 #elif HAVE_VFP
-        .fpu            vfp
+FPU     .fpu            vfp
 ELF     .eabi_attribute 10, 0           @ suppress Tag_FP_arch
 #endif
 
diff --git a/tests/checkasm/arm/checkasm.S b/tests/checkasm/arm/checkasm.S
index ab53d0a..098f22e 100644
--- a/tests/checkasm/arm/checkasm.S
+++ b/tests/checkasm/arm/checkasm.S
@@ -24,7 +24,7 @@ 
 
 /* override fpu so that NEON instructions are rejected */
 #if HAVE_VFP
-.fpu            vfp
+FPU     .fpu            vfp
 ELF     .eabi_attribute 10, 0           @ suppress Tag_FP_arch
 #endif