summaryrefslogtreecommitdiff
path: root/debian/check_nx
diff options
context:
space:
mode:
Diffstat (limited to 'debian/check_nx')
-rwxr-xr-xdebian/check_nx32
1 files changed, 32 insertions, 0 deletions
diff --git a/debian/check_nx b/debian/check_nx
new file mode 100755
index 00000000..061064d0
--- /dev/null
+++ b/debian/check_nx
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Helper script - check if a binary is tagged as NX-compatible or not.
+
+set -e
+
+for FILE in "$@"; do
+
+ if [ ! -f "${FILE}" ]; then
+ echo "${FILE} does not exist. ABORT."
+ exit 1
+ fi
+
+ echo "Checking NX bit on ${FILE}:"
+ DLL_CHARACTERISTICS=$(objdump -x "${FILE}" | awk '/DllCharacteristics/ {print $2}')
+
+ echo " DllCharacteristics $DLL_CHARACTERISTICS"
+ case $DLL_CHARACTERISTICS in
+ 00000000)
+ echo " NOT tagged as NX-compatible"
+ ;;
+ 00000100)
+ echo " tagged as NX-compatible"
+ ;;
+ *)
+ echo " UNRECOGNISED value, ABORT";
+ exit 1
+ ;;
+ esac
+
+done
+