shithub: openh264

Download patch

ref: d5a45ec513225dcf84379579970292c4e6598cf5
parent: a365b42d3b7b06bb07e6907c77acca77719c139a
author: Martin Storsjö <[email protected]>
date: Thu Jul 24 19:31:52 EDT 2014

Mark the x86 assembly object files as not requiring an executable stack

This avoids having to add extra linker flags in order to specify this.

This is similar to how this already is handled for the arm assembly.

--- a/Makefile
+++ b/Makefile
@@ -193,9 +193,6 @@
 ifeq ($(HAVE_GMP_API),Yes)
 plugin: $(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIX)
 LIBRARIES += $(LIBPREFIX)$(MODULE_NAME).$(SHAREDLIBSUFFIX)
-ifeq (linux,$(OS))
-LDFLAGS += -Wl,-z,noexecstack
-endif
 else
 plugin:
 	@echo "./gmp-api : No such file or directory."
--- a/build/platform-android.mk
+++ b/build/platform-android.mk
@@ -44,7 +44,7 @@
 CFLAGS += -DANDROID_NDK -fpic --sysroot=$(SYSROOT) -MMD -MP
 CXXFLAGS += -fno-rtti -fno-exceptions
 LDFLAGS += --sysroot=$(SYSROOT)
-SHLDFLAGS = -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-soname,lib$(PROJECT_NAME).so
+SHLDFLAGS = -Wl,--no-undefined -Wl,-z,relro -Wl,-z,now -Wl,-soname,lib$(PROJECT_NAME).so
 
 ifneq ($(CXX),$(wildcard $(CXX)))
 $(error Compiler not found, bad NDKROOT or ARCH?)
--- a/codec/common/x86/asm_inc.asm
+++ b/codec/common/x86/asm_inc.asm
@@ -116,6 +116,10 @@
 
 BITS 64
 
+%ifidn __OUTPUT_FORMAT__,elf64
+SECTION .note.GNU-stack noalloc noexec nowrite progbits ; Mark the stack as non-executable
+%endif
+
 %define arg1 rdi
 %define arg2 rsi
 %define arg3 rdx
@@ -165,6 +169,10 @@
 %elifdef X86_32 ; X86_32 ;************************************
 
 BITS 32
+
+%ifidn __OUTPUT_FORMAT__,elf
+SECTION .note.GNU-stack noalloc noexec nowrite progbits ; Mark the stack as non-executable
+%endif
 
 %define arg1 [esp + push_num*4 + 4]
 %define arg2 [esp + push_num*4 + 8]