You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-util/plan9port/files/plan9port-noexecstack.patch

55 lines
984 B

Remove unneeded executable stack
Assembly routines in libthread and libmp use an executable stack by
default. This is not needed and can be removed using --noexecstack.
The plan9port 9a wrapper wrapper needs to be modified to pass flags to the
underlying assembler first though..
Patch by Andy Spencer
http://code.swtch.com/plan9port/issue/76/
--- a/bin/9a
+++ b/bin/9a
@@ -1,10 +1,5 @@
#!/bin/sh
-if [ $# != 1 ]; then
- echo 'usage: 9a file.s' 1>&2
- exit 1
-fi
-
test -f $PLAN9/config && . $PLAN9/config
aflags=""
@@ -17,5 +12,16 @@ Darwin-*x86_64*)
;;
esac
-out=`echo $1 | sed 's/\.s$//;s/$/.o/'`
-exec as $aflags -o $out $1
+for arg; do
+ case $arg in
+ -*)
+ opts="$opts $arg"
+ ;;
+ *.s)
+ src=$arg
+ dst=$(echo $arg | sed 's/\.s/\.o/')
+ ;;
+ esac
+done
+
+exec as $aflags $opts -o $dst $src
--- a/src/mkhdr
+++ b/src/mkhdr
@@ -30,7 +30,7 @@ AR=9ar
INSTALL=install
CFLAGS=
LDFLAGS=
-AFLAGS=
+AFLAGS=--noexecstack
CLEANFILES=
NUKEFILES=
YACC=9 yacc