From 7051dea5f4863ff1d1a08fe89dbb23bd18898974 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Tue, 5 Jan 2016 15:49:32 -0700 Subject: 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 Reviewed-on: https://review.coreboot.org/12844 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Patrick Georgi --- util/xcompile/xcompile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'util/xcompile') diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile index b336f88c64..48df75b11b 100755 --- a/util/xcompile/xcompile +++ b/util/xcompile/xcompile @@ -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() { -- cgit v1.2.3