Skip to content

Commit

Permalink
s390/kpatch-build: add -fPIC flag with -mno-pic-data-is-text-relative
Browse files Browse the repository at this point in the history
-mno-pic-data-is-text-relative compiler flag expects -fPIC/-fPIE flag
along with it.  Since kernel commit 778666df60f0 ("s390: compile
relocatable kernel without -fPIE"), the -fPIC/-fPIE flag is missing when
creating kpatch module and this can lead to the following error:

cc1: error: ‘-mno-pic-data-is-text-relative’ cannot be used without
‘-fpic’/‘-fPIC’.

Previously kpatch-build didnt show up this issue, as the previous kernel
was built with -fPIE.

Fix kpatch-build by including -fPIC flag in ARCH_KCFLAGS for s390
platform. This ensures compatibility of kpatch-build with the latest
kernel.

Signed-off-by: Sumanth Korikkar <[email protected]>
  • Loading branch information
sumanthkorikkar committed Jun 20, 2024
1 parent 6457c4c commit 24e6672
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions kpatch-build/kpatch-build
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,7 @@ fi

if [[ "$ARCH" = "s390x" ]]; then
ARCH_KCFLAGS="-mno-pic-data-is-text-relative -fno-section-anchors"
kernel_version_gte 6.9.0 && ARCH_KCFLAGS+=" -fPIC"
fi

export KCFLAGS="-I$DATADIR/patch -ffunction-sections -fdata-sections \
Expand Down

0 comments on commit 24e6672

Please sign in to comment.