Skip to content

Commit 618916a

Browse files
anakryikoAlexei Starovoitov
authored andcommitted
kbuild: replace BASH-specific ${@:2} with shift and ${@}
${@:2} is BASH-specific extension, which makes link-vmlinux.sh rely on BASH. Use shift and ${@} instead to fix this issue. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Fixes: 341dfcf ("btf: expose BTF info through sysfs") Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Andrii Nakryiko <andriin@fb.com> Acked-by: Yonghong Song <yhs@fb.com> Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 1e46c09 commit 618916a

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

scripts/link-vmlinux.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,27 @@ modpost_link()
5757

5858
# Link of vmlinux
5959
# ${1} - output file
60-
# ${@:2} - optional extra .o files
60+
# ${2}, ${3}, ... - optional extra .o files
6161
vmlinux_link()
6262
{
6363
local lds="${objtree}/${KBUILD_LDS}"
64+
local output=${1}
6465
local objects
6566

67+
# skip output file argument
68+
shift
69+
6670
if [ "${SRCARCH}" != "um" ]; then
6771
objects="--whole-archive \
6872
${KBUILD_VMLINUX_OBJS} \
6973
--no-whole-archive \
7074
--start-group \
7175
${KBUILD_VMLINUX_LIBS} \
7276
--end-group \
73-
${@:2}"
77+
${@}"
7478

75-
${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} -o ${1} \
79+
${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} \
80+
-o ${output} \
7681
-T ${lds} ${objects}
7782
else
7883
objects="-Wl,--whole-archive \
@@ -81,9 +86,10 @@ vmlinux_link()
8186
-Wl,--start-group \
8287
${KBUILD_VMLINUX_LIBS} \
8388
-Wl,--end-group \
84-
${@:2}"
89+
${@}"
8590

86-
${CC} ${CFLAGS_vmlinux} -o ${1} \
91+
${CC} ${CFLAGS_vmlinux} \
92+
-o ${output} \
8793
-Wl,-T,${lds} \
8894
${objects} \
8995
-lutil -lrt -lpthread

0 commit comments

Comments
 (0)