shithub: openh264

Download patch

ref: 3cbdb84fd048410e59e6facde7b46409f2096296
parent: 4cb75fb16aab10c37983e885bb431039c41fe5e5
author: Martin Storsjö <martin@martin.st>
date: Wed Sep 16 18:52:34 EDT 2020

Fix building for arm/aarch64 mingw (with clang)

For aarch64, the assembly can be built as-is with clang, but some
ELF specific directives (that are stripped out by gas-preprocessor
when targeting armasm) need to be ifdeffed out.

For arm, the assembly still needs gas-preprocessor for making it
buildable as thumb, but the same kind of directives must be
ifdeffed out in this case as well.

--- a/build/platform-mingw_nt.mk
+++ b/build/platform-mingw_nt.mk
@@ -1,4 +1,4 @@
-include $(SRC_PATH)build/x86-common.mk
+include $(SRC_PATH)build/arch.mk
 SHAREDLIB_DIR = $(PREFIX)/bin
 SHAREDLIBSUFFIX = dll
 SHAREDLIBSUFFIXFULLVER=$(SHAREDLIBSUFFIX)
@@ -7,6 +7,7 @@
 SHLDFLAGS = -Wl,--out-implib,$(EXTRA_LIBRARY)
 CFLAGS += -MMD -MP
 LDFLAGS +=
+ifeq ($(ASM_ARCH), x86)
 ifeq ($(ARCH), x86_64)
 ASMFLAGS += -f win64
 ASMFLAGS_PLATFORM = -DWIN64
@@ -15,6 +16,11 @@
 AR = x86_64-w64-mingw32-ar
 else
 ASMFLAGS += -f win32 -DPREFIX
+endif
+endif
+ifeq ($(ASM_ARCH), arm)
+CCAS = gas-preprocessor.pl -as-type clang -force-thumb -- $(CC)
+CCASFLAGS = -DHAVE_NEON -mimplicit-it=always
 endif
 EXEEXT = .exe
 
--- a/codec/common/arm/arm_arch_common_macro.S
+++ b/codec/common/arm/arm_arch_common_macro.S
@@ -50,16 +50,22 @@
 .endm
 #else
 
+#ifdef __ELF__
 .section .note.GNU-stack,"",%progbits // Mark stack as non-executable
+#endif
 .text
+#ifdef __ELF__
 .arch armv7-a
 .fpu neon
+#endif
 
 .macro WELS_ASM_FUNC_BEGIN funcName
 .align 2
 .arm
 .global \funcName
+#ifdef __ELF__
 .type \funcName, %function
+#endif
 #ifndef __clang__
 .func \funcName
 #endif
--- a/codec/common/arm64/arm_arch64_common_macro.S
+++ b/codec/common/arm64/arm_arch64_common_macro.S
@@ -45,13 +45,17 @@
 .endm
 #else
 
+#ifdef __ELF__
 .section .note.GNU-stack,"",%progbits // Mark stack as non-executable
+#endif
 .text
 
 .macro WELS_ASM_AARCH64_FUNC_BEGIN funcName
 .align 2
 .global \funcName
+#ifdef __ELF__
 .type \funcName, %function
+#endif
 #ifndef __clang__
 .func \funcName
 #endif