Article 6M466 How to link some .o files in kernel?

How to link some .o files in kernel?

by
speranza
from LinuxQuestions.org on (#6M466)
Hi friends,I have a question.It has been bothering me for a while.Here is details:
I'm adding some ebpf helpers into the kernel.My kernel version is 5.15.153
I modify /kernel/bpf/helpers.c like that:
i
#include "../../security/dir/header.h"
i
BPF_CALL1(func1,argType,argName){
func2(argName);
return 0;
}
i

The function "func2" is in another .c file.That file can't be compiled with kernel because it uses some standard lib such as stdio,stdlib.So I compile it in gcc and get the .o file.I think maybe that .o file can be linked with "helpers.o".But I don't get any idea after I check the Makefile of the kernel and not find any information for this question.

Actually I find two similar question in stackoverflow and here:
https://stackoverflow.com/questions/...-kernel-binary
https://www.linuxquestions.org/quest...kbuild-694396/
But I don't think these can resolve my question.

I want to ask that is it possible to link a .o file with kernel?I think that I need to modify the Makefile in somewhere.
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments