1 Star 0 Fork 44

zhangxianting/kpatch

forked from src-openEuler/kpatch 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0017-kpatch-build-add-compile-flag-fno-reorder-functions.patch 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
HuBin95 提交于 2024-03-02 00:18 . kpatch: upgrade to 0.9.9
From 2573039f44d58727421c235dca385589f9246d83 Mon Sep 17 00:00:00 2001
From: Zhipeng Xie <xiezhipeng1@huawei.com>
Date: Thu, 12 Mar 2020 06:56:21 -0400
Subject: [PATCH 17/38] kpatch-build: add compile flag -fno-reorder-functions
Sometimes function foo with static variables can be put in
.text.foo section in original binary and be put in
.text.unlikely.foo section in patched binary. This will result
in "reference to static local variable xxx in foo was removed"
problem because the .text.foo section can not be correlated
to .text.unlikely.foo section by create-diff-object.
gcc just put the function in .text.unlikely.xxx section,the
symbol name doesn't change which is different with other
optimization such as ".constprop/.isra/.part". So disable the
optimization with -fno-reorder-functions just make sure the
function is placed in .text.xxx section, kernel can still find
the symbol name to patch or relocate.
Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
---
kpatch-build/kpatch-build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
index 67e56e1..0431e0b 100755
--- a/kpatch-build/kpatch-build
+++ b/kpatch-build/kpatch-build
@@ -1194,7 +1194,7 @@ if [[ "$ARCH" = "s390x" ]]; then
ARCH_KCFLAGS="-mno-pic-data-is-text-relative -fno-section-anchors"
fi
-export KCFLAGS="-I$DATADIR/patch -ffunction-sections -fdata-sections \
+export KCFLAGS="-I$DATADIR/patch -ffunction-sections -fdata-sections -fno-reorder-functions \
$ARCH_KCFLAGS $DEBUG_KCFLAGS"
echo "Reading special section data"
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangxianting/kpatch.git
git@gitee.com:zhangxianting/kpatch.git
zhangxianting
kpatch
kpatch
master

搜索帮助