aboutsummaryrefslogtreecommitdiffstats
path: root/testing/neko/mincoming-stack-boundary.patch
blob: 30c6e98275988aea9262fa6369cd8ef23cea2240 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 4b78044643c459a63bc87f6eadd50991df0301c7 Mon Sep 17 00:00:00 2001
From: Andy Li <andy@onthewings.net>
Date: Mon, 6 Jun 2016 22:22:57 +0000
Subject: [PATCH] only use -mincoming-stack-boundary when it is available
 From upstream: https://github.com/HaxeFoundation/neko/commit/4b78044643c459a63bc87f6eadd50991df0301c7

---
 CMakeLists.txt | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: neko-debian/CMakeLists.txt
===================================================================
--- neko-debian.orig/CMakeLists.txt
+++ neko-debian/CMakeLists.txt
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.8.7)
 
+include(CheckCCompilerFlag)
 project(neko C)
 
 set(CMAKE_OSX_ARCHITECTURES x86_64)
@@ -191,7 +192,13 @@ if(UNIX)
 
 	# https://github.com/HaxeFoundation/neko/pull/17
 	if(CMAKE_SIZEOF_VOID_P EQUAL 4)
-		add_compile_options(-mincoming-stack-boundary=2)
+		check_c_compiler_flag(-mincoming-stack-boundary=2 HAS_MINCOMING_STACK_BOUNDARY)
+		check_c_compiler_flag(-mstack-alignment=2 HAS_MSTACK_ALIGNMENT)
+		if(HAS_MINCOMING_STACK_BOUNDARY)
+			add_compile_options(-mincoming-stack-boundary=2)
+		elseif(HAS_MSTACK_ALIGNMENT)
+			add_compile_options(-mstack-alignment=2)
+		endif()
 	endif()
 
 	find_package(PkgConfig REQUIRED)