ref: 815c89528181877874213fded0f31a83ba1123db
parent: 1d2ec12245817e06991948b1c2ff972dd84bc0b1
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Oct 3 05:23:19 EDT 2021
tests/libc: Fix cc.sh in linux After the change in 2ae5e83c cc.sh was generating wrong code for linux and it was generating invalid elf binaries.
--- a/tests/libc/execute/cc.sh
+++ b/tests/libc/execute/cc.sh
@@ -41,16 +41,15 @@
cc=${CROSS_COMPILE}gcc
ld=${CROSS_COMPILE}ld
-if ${cc} -nopie 2>&1 | grep unrecogn >/dev/null
-then
- pie=-no-pie
-else
- pie=-nopie
-fi
+case `uname` in
+OpenBSD)
+ nopie=-no-pie
+ ;;
+esac
includes="-nostdinc -I$inc -I$arch_inc -I$sys_inc"
cflags="-std=c99 -g -w -fno-pie -fno-stack-protector -ffreestanding -static"
-ldflags="-g -z nodefaultlib -static $pie -L$lib"
+ldflags="-g -z nodefaultlib -static -L$lib"
$cc $cflags $includes -c $1
-$ld $ldflags $obj $crt -lc -lcrt -o $out
+$ld $ldflags $nopie $obj $crt -lc -lcrt -o $out