Blob Blame History Raw
From 99e9a6a67936c5784778579eb22bb7c108b7fca7 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Fri, 29 Apr 2011 12:17:51 +0200
Subject: [PATCH] Avoid marking stack as executable

Issue: http://code.google.com/p/lsyncd/issues/detail?id=55

If any of the object files lack .note.GNU-stack section, GNU linker
marks the resulting executable as having executable stack. This is not
needed, since luac.o does not contain executable code.
---
 Makefile.am |    3 ++-
 Makefile.in |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 957ec17..27784df 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -56,7 +56,8 @@ objtarget: | lsyncd.o
 luac.o: luac.out objarch objtarget
 	objcopy --input-target=binary \
 		--output-target=`cat objtarget` \
-		--binary-architecture=`cat objarch` $< $@
+		--binary-architecture=`cat objarch` \
+		--add-section .note.GNU-stack=/dev/null $< $@
 
 luac.out: lsyncd.lua
 	luac $<
diff --git a/Makefile.in b/Makefile.in
index 33d8c07..eb9bff3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -781,7 +781,8 @@ doc/lsyncd.1.xml: doc/lsyncd.1.txt
 @RUNNER_FALSE@luac.o: luac.out objarch objtarget
 @RUNNER_FALSE@	objcopy --input-target=binary \
 @RUNNER_FALSE@		--output-target=`cat objtarget` \
-@RUNNER_FALSE@		--binary-architecture=`cat objarch` $< $@
+@RUNNER_FALSE@		--binary-architecture=`cat objarch` \
+@RUNNER_FALSE@		--add-section .note.GNU-stack=/dev/null $< $@
 
 @RUNNER_FALSE@luac.out: lsyncd.lua
 @RUNNER_FALSE@	luac $<
-- 
1.7.4