xcompile: Use local variables in the test functions

Using the local variables instead of positional parameters helps
readability.
- Add and use the local variables in testcc.
- Use the existing local variables in testld.

Change-Id: Ice13288b830a7aa043b360eaee8e36f060589a18
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/12844
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Martin Roth 2016-01-05 15:49:32 -07:00
parent 033abe5e69
commit 7051dea5f4

View file

@ -74,11 +74,13 @@ HOSTCC?=${HOSTCC}
EOF
testcc() {
local cc="$1"
local cflags="$2"
local tmp_c="$TMPFILE.c"
local tmp_o="$TMPFILE.o"
rm -f "$tmp_c" "$tmp_o"
echo "void _start(void) {}" >"$tmp_c"
$1 -nostdlib -Werror $2 -c "$tmp_c" -o "$tmp_o" >/dev/null 2>&1
"$cc" -nostdlib -Werror $cflags -c "$tmp_c" -o "$tmp_o" >/dev/null 2>&1
}
testld() {
@ -89,8 +91,8 @@ testld() {
local tmp_o="$TMPFILE.o"
local tmp_elf="$TMPFILE.elf"
rm -f "$tmp_elf"
testcc $1 $2 &&
$3 -nostdlib -static $4 -o "$tmp_elf" "$tmp_o" >/dev/null 2>&1
testcc "$gcc" "$cflags" &&
$ld -nostdlib -static $ldflags -o "$tmp_elf" "$tmp_o" >/dev/null 2>&1
}
testas() {