I'm still learning the ropes of kernel development and I was wondering
if someone could help me figure out what is causing this error.
The file compiles when compiling with allyesconfig or olddefconfig, but
it cannot find the ipv6_dev_find() function when compiling with
allmodconfig and returns the error seen above. I am including
<include/net/addrconf.h> which declares ipv6_dev_find(), and the
function is defined and exported using EXPORT_SYMBOL in
<net/ipv6/addrconf.c>. I've tried declaring the function via extern in
<include/net/icmp.h> and in <net/ipv4/icmp.c>, but neither have
resolved the error and checkpatch.pl explicitly warns against using
extern calls in .c files.
Is there something that I'm not understanding about compiling kernel
components modularly? How do I avoid this error?
From: David Miller <davem@davemloft.net> Date: 2021-03-18 03:20:28
From: Andreas Roeseler <redacted>
Date: Wed, 17 Mar 2021 22:11:47 -0500
On Mon, 2021-03-15 at 04:35 +0800, kernel test robot wrote:
Is there something that I'm not understanding about compiling kernel
components modularly? How do I avoid this error?
You cannot reference module exported symbols from statically linked code.
y
From: David Ahern <hidden> Date: 2021-03-18 03:25:52
On 3/17/21 9:19 PM, David Miller wrote:
From: Andreas Roeseler <redacted>
Date: Wed, 17 Mar 2021 22:11:47 -0500
quoted
On Mon, 2021-03-15 at 04:35 +0800, kernel test robot wrote:
Is there something that I'm not understanding about compiling kernel
components modularly? How do I avoid this error?
quoted
You cannot reference module exported symbols from statically linked code.
y
Look at ipv6_stub to see how it exports IPv6 functions for v4 code.
There are a few examples under net/ipv4.
From: Andreas Roeseler <hidden> Date: 2021-03-20 16:02:19
On Wed, 2021-03-17 at 21:24 -0600, David Ahern wrote:
On 3/17/21 9:19 PM, David Miller wrote:
quoted
From: Andreas Roeseler <redacted>
Date: Wed, 17 Mar 2021 22:11:47 -0500
quoted
On Mon, 2021-03-15 at 04:35 +0800, kernel test robot wrote:
Is there something that I'm not understanding about compiling
kernel
components modularly? How do I avoid this error?
quoted
You cannot reference module exported symbols from statically linked
code.
y
Look at ipv6_stub to see how it exports IPv6 functions for v4 code.
There are a few examples under net/ipv4.
Thanks for the advice. I've been able to make some progress but I still
have some questions that I have been unable to find online.
What steps are required to include a function into the ipv6_stub
struct? I've added the declaration of the function to the struct, but
when I attempt to call it using <ipv6_stub->ipv6_dev_find()> the kernel
locks up. Additionally, a typo in the declaration isn't flagged during
compilation. Are there other places where I need to edit the ipv6_stub
struct or include various headers? The examples I have looked at are
<fib_semantics.c>, <nexthop.c>, and <udp.c> in the <net/ipv4> folder
and they don't seem to do anything on the caller side of ipv6_stub, so
I think I am not adding the function to ipv6_stub properly. I have been
able to call other functions that currently exist in ipv6_stub, but not
the one I am attempting to add, so am I missing a step?
I've noticed that some functions such as <ipv6_route_input> aren't
exported using EXPORT_SYMBOL when it is defined in
<net/ipv6/af_inet6.c>, but it is still loaded into ipv6_stub. How can
this be? Is there a different way to include symbols into ipv6_stub
based on whether or not they are explicitly exported using
EXPORT_SYMBOL?
From: David Ahern <hidden> Date: 2021-03-20 16:43:54
On 3/20/21 10:01 AM, Andreas Roeseler wrote:
On Wed, 2021-03-17 at 21:24 -0600, David Ahern wrote:
quoted
On 3/17/21 9:19 PM, David Miller wrote:
quoted
From: Andreas Roeseler <redacted>
Date: Wed, 17 Mar 2021 22:11:47 -0500
quoted
On Mon, 2021-03-15 at 04:35 +0800, kernel test robot wrote:
Is there something that I'm not understanding about compiling
kernel
components modularly? How do I avoid this error?
quoted
You cannot reference module exported symbols from statically linked
code.
y
Look at ipv6_stub to see how it exports IPv6 functions for v4 code.
There are a few examples under net/ipv4.
Thanks for the advice. I've been able to make some progress but I still
have some questions that I have been unable to find online.
What steps are required to include a function into the ipv6_stub
struct? I've added the declaration of the function to the struct, but
when I attempt to call it using <ipv6_stub->ipv6_dev_find()> the kernel
locks up. Additionally, a typo in the declaration isn't flagged during
compilation. Are there other places where I need to edit the ipv6_stub
struct or include various headers? The examples I have looked at are
<fib_semantics.c>, <nexthop.c>, and <udp.c> in the <net/ipv4> folder
and they don't seem to do anything on the caller side of ipv6_stub, so
I think I am not adding the function to ipv6_stub properly. I have been
able to call other functions that currently exist in ipv6_stub, but not
the one I am attempting to add, so am I missing a step?
you probably did not add the default in net/ipv6/addrconf_core.c.
I've noticed that some functions such as <ipv6_route_input> aren't
exported using EXPORT_SYMBOL when it is defined in
<net/ipv6/af_inet6.c>, but it is still loaded into ipv6_stub. How can
this be? Is there a different way to include symbols into ipv6_stub
based on whether or not they are explicitly exported using
EXPORT_SYMBOL?
take a look at 1aefd3de7bc6 as an example of how to add a new stub.