Martin Roth (martinroth@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12844
-gerrit
commit 7707c0537e443661d3b54229266010897c86e3b4 Author: Martin Roth martinroth@google.com Date: Tue Jan 5 15:49:32 2016 -0700
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 --- util/xcompile/xcompile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile index b336f88..48df75b 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() {