arm: Emit .thumb_func directives

Message ID 20181012114356.82706-1-martin@martin.st
State New
Headers show
Series
  • arm: Emit .thumb_func directives
Related show

Commit Message

Martin Storsjö Oct. 12, 2018, 11:43 a.m.
Prior to Xcode 9.3, the clang built-in assembler didn't support
altmacro, and gas-preprocessor was used for assembling for arm/darwin.

For thumb functions, gas-preprocessor took care of adding the .thumb_func
directives, but when now being able to assemble without gas-preprocessor,
we need to add these directives ourselves.
---
 libavutil/arm/asm.S | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Janne Grunau Oct. 12, 2018, 7:01 p.m. | #1
On 2018-10-12 14:43:56 +0300, Martin Storsjö wrote:
> Prior to Xcode 9.3, the clang built-in assembler didn't support
> altmacro, and gas-preprocessor was used for assembling for arm/darwin.
> 
> For thumb functions, gas-preprocessor took care of adding the .thumb_func
> directives, but when now being able to assemble without gas-preprocessor,
> we need to add these directives ourselves.
> ---
>  libavutil/arm/asm.S | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
> index e7eea0271f..5207a1a2b8 100644
> --- a/libavutil/arm/asm.S
> +++ b/libavutil/arm/asm.S
> @@ -75,6 +75,12 @@ T       .thumb
>  ELF     .eabi_attribute 25, 1           @ Tag_ABI_align_preserved
>  ELF     .section .note.GNU-stack,"",%progbits @ Mark stack as non-executable
>  
> +.macro func_mode name
> +#if CONFIG_THUMB && defined(__APPLE__)
> +        .thumb_func \name
> +#endif
> +.endm
> +
>  .macro  function name, export=0, align=2
>          .set            .Lpic_idx, 0
>          .set            .Lpic_gp, 0
> @@ -98,10 +104,12 @@ FUNC    .endfunc
>          .global EXTERN_ASM\name
>  ELF     .type   EXTERN_ASM\name, %function
>  FUNC    .func   EXTERN_ASM\name
> +        func_mode EXTERN_ASM\name
>  EXTERN_ASM\name:
>      .else
>  ELF     .type   \name, %function
>  FUNC    .func   \name
> +        func_mode \name
>  \name:
>      .endif
>  .endm
> -- 

patch ok either in this form or as discussed on irc

Janne

Patch

diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index e7eea0271f..5207a1a2b8 100644
--- a/libavutil/arm/asm.S
+++ b/libavutil/arm/asm.S
@@ -75,6 +75,12 @@  T       .thumb
 ELF     .eabi_attribute 25, 1           @ Tag_ABI_align_preserved
 ELF     .section .note.GNU-stack,"",%progbits @ Mark stack as non-executable
 
+.macro func_mode name
+#if CONFIG_THUMB && defined(__APPLE__)
+        .thumb_func \name
+#endif
+.endm
+
 .macro  function name, export=0, align=2
         .set            .Lpic_idx, 0
         .set            .Lpic_gp, 0
@@ -98,10 +104,12 @@  FUNC    .endfunc
         .global EXTERN_ASM\name
 ELF     .type   EXTERN_ASM\name, %function
 FUNC    .func   EXTERN_ASM\name
+        func_mode EXTERN_ASM\name
 EXTERN_ASM\name:
     .else
 ELF     .type   \name, %function
 FUNC    .func   \name
+        func_mode \name
 \name:
     .endif
 .endm