Skip to content

Commit 65e1f38

Browse files
ihalipwilldeacon
authored andcommitted
scripts/tools-support-relr.sh: un-quote variables
When the CC variable contains quotes, e.g. when using ccache (make CC="ccache <compiler>"), this script always fails, so CONFIG_RELR is never enabled, even when the toolchain supports this feature. Removing the /dev/null redirect and invoking the script manually shows the issue: $ CC='/usr/bin/ccache clang' ./scripts/tools-support-relr.sh ./scripts/tools-support-relr.sh: 7: ./scripts/tools-support-relr.sh: /usr/bin/ccache clang: not found Fix this by un-quoting the variables. Before: $ make ARCH=arm64 CC='/usr/bin/ccache clang' LD=ld.lld \ NM=llvm-nm OBJCOPY=llvm-objcopy defconfig $ grep RELR .config CONFIG_ARCH_HAS_RELR=y With this change: $ make ARCH=arm64 CC='/usr/bin/ccache clang' LD=ld.lld \ NM=llvm-nm OBJCOPY=llvm-objcopy defconfig $ grep RELR .config CONFIG_TOOLS_SUPPORT_RELR=y CONFIG_ARCH_HAS_RELR=y CONFIG_RELR=y Fixes: 5cf896f ("arm64: Add support for relocating the kernel with RELR relocations") Reported-by: Dmitry Golovin <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Reviewed-by: Masahiro Yamada <[email protected]> Link: ClangBuiltLinux#769 Cc: Peter Collingbourne <[email protected]> Signed-off-by: Ilie Halip <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent 6767df2 commit 65e1f38

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/tools-support-relr.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
tmp_file=$(mktemp)
55
trap "rm -f $tmp_file.o $tmp_file $tmp_file.bin" EXIT
66

7-
cat << "END" | "$CC" -c -x c - -o $tmp_file.o >/dev/null 2>&1
7+
cat << "END" | $CC -c -x c - -o $tmp_file.o >/dev/null 2>&1
88
void *p = &p;
99
END
10-
"$LD" $tmp_file.o -shared -Bsymbolic --pack-dyn-relocs=relr -o $tmp_file
10+
$LD $tmp_file.o -shared -Bsymbolic --pack-dyn-relocs=relr -o $tmp_file
1111

1212
# Despite printing an error message, GNU nm still exits with exit code 0 if it
1313
# sees a relr section. So we need to check that nothing is printed to stderr.
14-
test -z "$("$NM" $tmp_file 2>&1 >/dev/null)"
14+
test -z "$($NM $tmp_file 2>&1 >/dev/null)"
1515

16-
"$OBJCOPY" -O binary $tmp_file $tmp_file.bin
16+
$OBJCOPY -O binary $tmp_file $tmp_file.bin

0 commit comments

Comments
 (0)