xcompile: Quote variables to prevent globbing and splitting.
Quoting variables prevents word splitting and glob expansion, and prevents the script from breaking when input contains spaces, line feeds, glob characters and such. See shellcheck warning SC2086 Change-Id: Ib6ca46b64a621c4bea5c33ac312f2824b0386235 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/12845 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:
parent
7051dea5f4
commit
2ba837d8c7
|
@ -52,7 +52,7 @@ program_exists() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [ "$(${XGCCPATH}/iasl 2>/dev/null | grep -c ACPI)" -gt 0 ]; then
|
if [ "$("${XGCCPATH}/iasl" 2>/dev/null | grep -c ACPI)" -gt 0 ]; then
|
||||||
IASL=${XGCCPATH}iasl
|
IASL=${XGCCPATH}iasl
|
||||||
elif [ "$(iasl 2>/dev/null | grep -c ACPI)" -gt 0 ]; then
|
elif [ "$(iasl 2>/dev/null | grep -c ACPI)" -gt 0 ]; then
|
||||||
IASL=iasl
|
IASL=iasl
|
||||||
|
@ -107,11 +107,11 @@ testas() {
|
||||||
rm -f "$obj_file"
|
rm -f "$obj_file"
|
||||||
[ -n "$use_dash_twidth" ] && use_dash_twidth="--$twidth"
|
[ -n "$use_dash_twidth" ] && use_dash_twidth="--$twidth"
|
||||||
[ -n "$endian" ] && endian="-$endian"
|
[ -n "$endian" ] && endian="-$endian"
|
||||||
${gccprefix}as $use_dash_twidth $endian -o "$obj_file" $TMPFILE \
|
"${gccprefix}as" $use_dash_twidth $endian -o "$obj_file" "$TMPFILE" \
|
||||||
2>/dev/null || return 1
|
2>/dev/null || return 1
|
||||||
|
|
||||||
# Check output content type.
|
# Check output content type.
|
||||||
local obj_type="$(LANG=C LC_ALL= ${gccprefix}objdump -p $obj_file 2>/dev/null)"
|
local obj_type="$(LANG=C LC_ALL='' "${gccprefix}"objdump -p "$obj_file" 2>/dev/null)"
|
||||||
local obj_arch="$(expr "$obj_type" : '.*format \(.[a-z0-9-]*\)')"
|
local obj_arch="$(expr "$obj_type" : '.*format \(.[a-z0-9-]*\)')"
|
||||||
[ "$obj_arch" = "$full_arch" ] || return 1
|
[ "$obj_arch" = "$full_arch" ] || return 1
|
||||||
|
|
||||||
|
@ -329,8 +329,8 @@ test_architecture() {
|
||||||
unset TABI TARCH TBFDARCH TCLIST TENDIAN TSUPP TWIDTH
|
unset TABI TARCH TBFDARCH TCLIST TENDIAN TSUPP TWIDTH
|
||||||
unset CC_RT_EXTRA_GCC CC_RT_EXTRA_CLANG
|
unset CC_RT_EXTRA_GCC CC_RT_EXTRA_CLANG
|
||||||
unset GCC CLANG
|
unset GCC CLANG
|
||||||
if type arch_config_$architecture > /dev/null; then
|
if type "arch_config_$architecture" > /dev/null; then
|
||||||
arch_config_$architecture
|
"arch_config_$architecture"
|
||||||
else
|
else
|
||||||
die "no architecture definition for $architecture"
|
die "no architecture definition for $architecture"
|
||||||
fi
|
fi
|
||||||
|
@ -339,7 +339,7 @@ test_architecture() {
|
||||||
# environment variable.
|
# environment variable.
|
||||||
# Ex: CROSS_COMPILE_arm="armv7a-cros-linux-gnueabi-"
|
# Ex: CROSS_COMPILE_arm="armv7a-cros-linux-gnueabi-"
|
||||||
# CROSS_COMPILE_x86="i686-pc-linux-gnu-"
|
# CROSS_COMPILE_x86="i686-pc-linux-gnu-"
|
||||||
search="$(eval echo \$CROSS_COMPILE_$architecture 2>/dev/null)"
|
search="$(eval echo "\$CROSS_COMPILE_$architecture" 2>/dev/null)"
|
||||||
search="$search $CROSS_COMPILE"
|
search="$search $CROSS_COMPILE"
|
||||||
for toolchain in $TCLIST; do
|
for toolchain in $TCLIST; do
|
||||||
search="$search $XGCCPATH$toolchain-$TABI-"
|
search="$search $XGCCPATH$toolchain-$TABI-"
|
||||||
|
@ -382,7 +382,7 @@ test_architecture() {
|
||||||
|
|
||||||
# This loops over all supported architectures.
|
# This loops over all supported architectures.
|
||||||
for architecture in $SUPPORTED_ARCHITECTURES; do
|
for architecture in $SUPPORTED_ARCHITECTURES; do
|
||||||
test_architecture $architecture
|
test_architecture "$architecture"
|
||||||
detect_special_flags "$architecture"
|
detect_special_flags "$architecture"
|
||||||
detect_compiler_runtime "$architecture"
|
detect_compiler_runtime "$architecture"
|
||||||
report_arch_toolchain
|
report_arch_toolchain
|
||||||
|
|
Loading…
Reference in New Issue