On 3/20/21 10:01 AM, Andreas Roeseler wrote: > On Wed, 2021-03-17 at 21:24 -0600, David Ahern wrote: >> On 3/17/21 9:19 PM, David Miller wrote: >>> From: Andreas Roeseler <andreas.a.roese...@gmail.com> >>> 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 >>> >> >> 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.