xref: /xnu-8792.81.2/libkern/kmod/README (revision 19c3b8c28c31cb8130e034cfb5df6bf9ba342d90)
1*19c3b8c2SApple OSS Distributions#
2*19c3b8c2SApple OSS Distributions# Subtle combination of files and libraries make up the C++ runtime system for
3*19c3b8c2SApple OSS Distributions# kernel modules.  We are dependant on the KernelModule kmod.make and
4*19c3b8c2SApple OSS Distributions# CreateKModInfo.perl scripts to be exactly instep with both this library
5*19c3b8c2SApple OSS Distributions# module and the libkmod module as well.
6*19c3b8c2SApple OSS Distributions#
7*19c3b8c2SApple OSS Distributions# If you do any maintenance on any of the following files make sure great
8*19c3b8c2SApple OSS Distributions# care is taken to keep them in Sync.
9*19c3b8c2SApple OSS Distributions#    extenTools/KernelModule.bproj/kmod.make
10*19c3b8c2SApple OSS Distributions#    extenTools/KernelModule.bproj/CreateKModInfo.perl
11*19c3b8c2SApple OSS Distributions#    IOKitUser/kmodc++/pure.c
12*19c3b8c2SApple OSS Distributions#    IOKitUser/kmodc++/cplus_start.c
13*19c3b8c2SApple OSS Distributions#    IOKitUser/kmodc++/cplus_start.c
14*19c3b8c2SApple OSS Distributions#    IOKitUser/kmodc/c_start.c
15*19c3b8c2SApple OSS Distributions#    IOKitUser/kmodc/c_stop.c
16*19c3b8c2SApple OSS Distributions#
17*19c3b8c2SApple OSS Distributions# The trick is that the linkline links all of the developers modules.
18*19c3b8c2SApple OSS Distributions# If any static constructors are used .constructors_used will be left as
19*19c3b8c2SApple OSS Distributions# an undefined symbol.  This symbol is exported by the cplus_start.c routine
20*19c3b8c2SApple OSS Distributions# which automatically brings in the appropriate C++ _start routine.  However
21*19c3b8c2SApple OSS Distributions# the actual _start symbol is only required by the kmod_info structure that
22*19c3b8c2SApple OSS Distributions# is created and initialized by the CreateKModInfo.perl script.  If no C++
23*19c3b8c2SApple OSS Distributions# was used the _start will be an undefined symbol that is finally satisfied
24*19c3b8c2SApple OSS Distributions# by the c_start module in the kmod library.
25*19c3b8c2SApple OSS Distributions#
26*19c3b8c2SApple OSS Distributions# The linkline must look like this.
27*19c3b8c2SApple OSS Distributions#    *.o -lkmodc++ kmod_info.o -lkmod
28*19c3b8c2SApple OSS Distributions#
29