Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu22.04版本编译Linux内核5.4.34时遇到兼容性问题解决方案 #22

Open
eagle-f opened this issue Mar 20, 2024 · 0 comments

Comments

@eagle-f
Copy link

eagle-f commented Mar 20, 2024

实验代码环境适配Ubuntu20.04及以下版本,使用Ubuntu22.04做的时候可能会出现兼容性问题,即make -j$(nproc)编译不通过等。可以通过以下方案解决,仅供参考:
新建一个文件thunkpatch.patch 填入:

 tools/objtool/elf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
 
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index be89c741ba9a..2b0f4f52f7b5 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -380,8 +380,11 @@ static int read_symbols(struct elf *elf)
 
 	symtab = find_section_by_name(elf, ".symtab");
 	if (!symtab) {
-		WARN("missing symbol table");
-		return -1;
+		/*
+		 * A missing symbol table is actually possible if it's an empty
+		 * .o file.  This can happen for thunk_64.o.
+		 */
+		return 0;
 	}
 
 	symtab_shndx = find_section_by_name(elf, ".symtab_shndx");

--
2.29.2

然后在Linux源码目录下执行
patch -p1 < thunkpatch.patch所在目录/thunkpatch.patch
再次编译就可以解决问题。

该方案改变了elf.c文件中的read_symbols函数,使之忽略.o文件中缺少symbol table的情况,使得编译能顺利进行下去

转载自https://www.spinics.net/lists/kernel/msg3797871.html 详情可见该帖

@mengning mengning changed the title Ubuntu22.04版本编译时遇到兼容性问题解决方案 Ubuntu22.04版本编译Linux内核5.4.34时遇到兼容性问题解决方案 Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant