powerpc/boot: Fix dash warning
Madhavan Srinivasan
maintainerPATCH 1/1 powerpc/boot: Fix dash warning
Commit b2accfe7ca5b '("powerpc/boot: Check for ld-option support")' suppressed linker warnings, but the expressed used did not go well with POSIX shell (dash) resulting with this warning
arch/powerpc/boot/wrapper: 237: [: 0: unexpected operator
ld: warning: arch/powerpc/boot/zImage.epapr has a LOAD segment with RWX permissions
Fix the check to handle the reported warning. Patch also fixes couple of shellcheck reported errors for the same line.
In arch/powerpc/boot/wrapper line 237:
if [ $(${CROSS}ld -v --no-warn-rwx-segments &>/dev/null; echo $?) -eq 0 ]; then
^-- SC2046 (warning): Quote this to prevent word splitting.
^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
^---------^ SC3020 (warning): In POSIX sh, &> is undefined.
---
Patch applies clean on top of powerpc/fixes branch
arch/powerpc/boot/wrapper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/boot/wrapper +1 -1
@@ -234,7 +234,7 @@ fi # suppress some warnings in recent ld versions nowarn="-z noexecstack" -if [ $(${CROSS}ld -v --no-warn-rwx-segments &>/dev/null; echo $?) -eq 0 ]; then +if [ "$("${CROSS}"ld -v --no-warn-rwx-segments >/dev/null 2>&1; echo $?)" -eq 0 ]; then nowarn="$nowarn --no-warn-rwx-segments" fi
Signature · 1 line
2.49.0
Hi Madhavan,
arch/powerpc/boot/wrapper fi · line 239
Quoted 7 lines · On Tue, 22 Apr 2025 17:00:23 +0530 Madhavan Srinivasan <[email protected]>…
# suppress some warnings in recent ld versions nowarn="-z noexecstack"arch/powerpc/boot/wrapper +1
-1-if [ $(${CROSS}ld -v --no-warn-rwx-segments &>/dev/null; echo $?) -eq 0 ]; then +if [ "$("${CROSS}"ld -v --no-warn-rwx-segments >/dev/null 2>&1; echo $?)" -eq 0 ]; then nowarn="$nowarn --no-warn-rwx-segments" fi
On the way to bed, it occurred to me that the above "if" line can be written as:
if "${CROSS}ld" -v --no-warn-rwx-segments >/dev/null 2>&1; then
Signature · 2 lines
Cheers, Stephen Rothwell
Madhavan Srinivasan
maintainerQuoted 14 lines · Stephen Rothwell
Hi Madhavan,
arch/powerpc/boot/wrapper fi · line 239
Quoted 7 lines · On Tue, 22 Apr 2025 17:00:23 +0530 Madhavan Srinivasan <[email protected]>…
# suppress some warnings in recent ld versions nowarn="-z noexecstack"arch/powerpc/boot/wrapper +1
-1-if [ $(${CROSS}ld -v --no-warn-rwx-segments &>/dev/null; echo $?) -eq 0 ]; then +if [ "$("${CROSS}"ld -v --no-warn-rwx-segments >/dev/null 2>&1; echo $?)" -eq 0 ]; then nowarn="$nowarn --no-warn-rwx-segments" fiOn the way to bed, it occurred to me that the above "if" line can be written as:
Quoted 1 line
if "${CROSS}ld" -v --no-warn-rwx-segments >/dev/null 2>&1; then
if command; then
# Commands to execute if the command succeeds (exit status 0)
fi
Yeah nice, Will fix and send a v2
Maddy