Skip to content

Commit 1473127

Browse files
committed
fixup perf
1 parent abdb27f commit 1473127

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

_in_container_build.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ get_cc() {
6666
for VERSION in $VERSIONS; do
6767
make -C /app/linux/$VERSION mrproper
6868
for TARGET in $TARGETS; do
69+
unset KCFLAGS KBUILD_CFLAGS HOSTCFLAGS
6970
BUILD_TARGETS="vmlinux"
7071
if [ $TARGET == "armel" ]; then
7172
BUILD_TARGETS="vmlinux zImage"
@@ -128,6 +129,12 @@ for TARGET in $TARGETS; do
128129
diff -u <(sort /tmp/build/${VERSION}/${TARGET}/.config) <(sort /tmp/build/${VERSION}/${TARGET}/defconfig | sed '/^[ #]/d')
129130
else
130131
echo "Building kernel for $TARGET"
132+
# 2. Inject missing label for x86_64 R_X86_64_PLT32 backport bug
133+
if [[ "$VERSION" == "4.10" && "$TARGET" == "x86_64" ]]; then
134+
grep -q "invalid_relocation:" /app/linux/$VERSION/arch/x86/kernel/module.c || \
135+
sed -i 's/overflow:/invalid_relocation:\n\treturn -ENOEXEC;\noverflow:/g' /app/linux/$VERSION/arch/x86/kernel/module.c
136+
fi
137+
131138
make -C /app/linux/$VERSION ARCH=${short_arch} CROSS_COMPILE=$(get_cc $TARGET $VERSION) O=/tmp/build/${VERSION}/${TARGET}/ olddefconfig
132139
if $MENU_CONFIG; then
133140
make -C /app/linux/$VERSION ARCH=${short_arch} CROSS_COMPILE=$(get_cc $TARGET $VERSION) O=/tmp/build/${VERSION}/${TARGET}/ menuconfig
@@ -151,10 +158,19 @@ for TARGET in $TARGETS; do
151158
rm -rf "$PERF_OUTDIR"
152159
mkdir -p "$PERF_OUTDIR"
153160

161+
# 3. Prepare specific Linker flags for MIPS64 ABI mismatches
162+
PERF_LD="$(get_cc $TARGET $VERSION)ld"
163+
if [[ "$TARGET" == *"mips64el"* ]]; then
164+
PERF_LD="${PERF_LD} -m elf64ltsmip"
165+
elif [[ "$TARGET" == *"mips64eb"* || "$TARGET" == "mips64" ]]; then
166+
PERF_LD="${PERF_LD} -m elf64btsmip"
167+
fi
168+
154169
# Build perf utility statically
155170
make -C /app/linux/$VERSION/tools/perf \
156171
ARCH=${short_arch} \
157172
CROSS_COMPILE=$(get_cc $TARGET $VERSION) \
173+
LD="$PERF_LD" \
158174
OUTPUT="$PERF_OUTDIR" \
159175
LDFLAGS="-static" \
160176
WERROR=0 \

0 commit comments

Comments
 (0)