shithub: openh264

Download patch

ref: b1a76aa936c3d02e6f538bfdf7ee87ca0cb66459
parent: 6ba537bee5d5f4562d10cac4136ceab3401f0c8f
parent: d5a45ec513225dcf84379579970292c4e6598cf5
author: zhilwang <[email protected]>
date: Fri Jul 25 10:15:17 EDT 2014

Merge pull request #1215 from mstorsjo/x86-asm-noexec-stack

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

--- a/Makefile
+++ b/Makefile
@@ -194,9 +194,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
@@ -17,7 +17,7 @@
 else ifeq ($(ARCH), x86)
   APP_ABI = x86
   ifeq (Yes, $(USE_ASM))
-    ASMFLAGS += -f elf32
+    ASMFLAGS += -f elf
   endif
 else ifeq ($(ARCH), x86_64)
   APP_ABI = x86_64
@@ -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/build/platform-linux.mk
+++ b/build/platform-linux.mk
@@ -6,7 +6,7 @@
 ifeq ($(ENABLE64BIT), Yes)
 ASMFLAGS += -f elf64
 else
-ASMFLAGS += -f elf32
+ASMFLAGS += -f elf
 endif
 endif
 ifeq ($(ASM_ARCH), arm)
--- 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]