commit 52c9f69d5955ab73cd5bfa317d9a21edcf2299aa
parent 359cc22ee4a0fb2a8bb2ec66859ff73b533bf12a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 3 Oct 2021 09:23:19 +0200
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.
Diffstat:
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/tests/libc/execute/cc.sh b/tests/libc/execute/cc.sh
@@ -41,16 +41,15 @@ obj=${1%.c}.o
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