Skip to content

Commit

Permalink
kbuild: replace BASH-specific ${@:2} with shift and ${@}
Browse files Browse the repository at this point in the history
${@: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>
  • Loading branch information
Andrii Nakryiko authored and Alexei Starovoitov committed Sep 6, 2019
1 parent 1e46c09 commit 618916a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions scripts/link-vmlinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,27 @@ modpost_link()

# Link of vmlinux
# ${1} - output file
# ${@:2} - optional extra .o files
# ${2}, ${3}, ... - optional extra .o files
vmlinux_link()
{
local lds="${objtree}/${KBUILD_LDS}"
local output=${1}
local objects

# skip output file argument
shift

if [ "${SRCARCH}" != "um" ]; then
objects="--whole-archive \
${KBUILD_VMLINUX_OBJS} \
--no-whole-archive \
--start-group \
${KBUILD_VMLINUX_LIBS} \
--end-group \
${@:2}"
${@}"

${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} -o ${1} \
${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} \
-o ${output} \
-T ${lds} ${objects}
else
objects="-Wl,--whole-archive \
Expand All @@ -81,9 +86,10 @@ vmlinux_link()
-Wl,--start-group \
${KBUILD_VMLINUX_LIBS} \
-Wl,--end-group \
${@:2}"
${@}"

${CC} ${CFLAGS_vmlinux} -o ${1} \
${CC} ${CFLAGS_vmlinux} \
-o ${output} \
-Wl,-T,${lds} \
${objects} \
-lutil -lrt -lpthread
Expand Down

0 comments on commit 618916a

Please sign in to comment.