kpatch-cc: fix stripping of source tree prefix

To support building out-of-tree kernel modules, the source tree prefix
is attempted to be stripped from change object file paths to make them
relative. However, if the path is already relative, the change can
strip a substring instead, resulting in build errors.

Ensure just the prefix is stripped instead of any substring.

Fixes: #1282
Fixes: 51a8fad34f ("Add support for building out-of-tree modules")
This commit is contained in:
Johannes Erdfelt 2022-07-27 10:29:36 -07:00
parent 6992acf9c2
commit 07433e98c0
1 changed files with 1 additions and 1 deletions

View File

@ -23,7 +23,7 @@ if [[ "$TOOLCHAINCMD" =~ ^(.*-)?gcc$ || "$TOOLCHAINCMD" =~ ^(.*-)?clang$ ]] ; th
[[ "$obj" = */.tmp_mc_*.o ]] && break;
[[ "$obj" = */.tmp_*.o ]] && obj="${obj/.tmp_/}"
relobj=${obj//$KPATCH_GCC_SRCDIR\//}
relobj=${obj##$KPATCH_GCC_SRCDIR/}
case "$relobj" in
*.mod.o|\
*built-in.o|\