Discussion:
[PATCH] arm: Emit .thumb_func directives
(too old to reply)
Martin Storsjö
2018-10-12 11:43:56 UTC
Permalink
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
--
2.17.1 (Apple Git-112)
Janne Grunau
2018-10-12 19:01:30 UTC
Permalink
Post by Martin Storsjö
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
+.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
.else
ELF .type \name, %function
FUNC .func \name
+ func_mode \name
.endif
.endm
--
patch ok either in this form or as discussed on irc

Janne

Continue reading on narkive:
Loading...