开发者

static linking in the make file at kernel level

开发者 https://www.devze.com 2023-01-29 11:45 出处:网络
i have created a kernel module that uses kernel level functions such as vfs_read, write etc. This module has a makefile that builds this module to get the .ko file. I want to analyze the objdump outpu

i have created a kernel module that uses kernel level functions such as vfs_read, write etc. This module has a makefile that builds this module to get the .ko file. I want to analyze the objdump output of this .ko file. However I observed that kernel functions such as vfs_read and write are not resolved in the .ko file. They are just called and my guess is that they are resolved at run time. Is it possible to make some changes in the makefile and statically link all these functions in the single .ko file just for the purpose of analysi开发者_如何学Gos. I tried adding static while compiling but i did not help. Can anyone suggest anyway of doing so?


Please see the ld(1) manual for what -static does:

-static     Do not link against shared libraries.

Since a kernel module does not link against any shared libraries (or any library for that matter), it has no effect.

The kernel resolves the undefined references at load time using its own "function pool". So the link only exists in memory, or when you put your code into the kernel.

0

精彩评论

暂无评论...
验证码 换一张
取 消