summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/unit.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/unit.sh b/tools/unit.sh
index ded1b29..ace28fb 100755
--- a/tools/unit.sh
+++ b/tools/unit.sh
@@ -59,7 +59,7 @@ once() {
 		LNK="$ASM"
 	fi
 
-	if ! cc -no-pie -g -o $BIN $LNK
+	if ! cc $PIE -g -o $BIN $LNK
 	then
 		echo "[cc fail]"
 		return 1
@@ -94,6 +94,15 @@ then
 	exit 1
 fi
 
+for wtf in -nopie -no-pie
+do
+	if echo "int main() { return 0; }" |
+	   cc $wtf -x c -o /dev/null - >/dev/null 2>&1
+	then
+		PIE=$wtf
+	fi
+done
+
 case $1 in
 	"all")
 		F=0