{"id":1673,"date":"2022-08-30T15:18:29","date_gmt":"2022-08-30T15:18:29","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/27\/linux-kernel-module-linker-warnings-warning-function-module-undefined-any-way-to-get-rid-of-them-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:18:29","modified_gmt":"2022-08-30T15:18:29","slug":"linux-kernel-module-linker-warnings-warning-function-module-undefined-any-way-to-get-rid-of-them-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/linux-kernel-module-linker-warnings-warning-function-module-undefined-any-way-to-get-rid-of-them-collection-of-common-programming-errors\/","title":{"rendered":"linux kernel module linker warnings: &ldquo;*** Warning: &lt;function&gt; [&lt;module&gt;] undefined!&rdquo; &#8211; any way to get rid of them?-Collection of common programming errors"},"content":{"rendered":"<p>Finally, I got it. Thanks to shodanex for putting me on the right track.<\/p>\n<p><strong><em>Update:<\/em><\/strong> Be very careful when applying this fix to builds for older versions of kernel, as there is a bug in <strong>Makefile.modpost<\/strong> file in older versions of the kernel which makes your build misbehave and build wrong targets when you specify <strong>KBUILD_EXTMOD<\/strong> option.<\/p>\n<p>You have to specify the paths to the source of the modules you depend on in <strong>KBUILD_EXTMOD<\/strong> make parameter.<\/p>\n<p>Say, you have a module <strong>foo<\/strong> that depends on symbols from module <strong>bar<\/strong>.<\/p>\n<p>Source files for <strong>foo<\/strong> are in <strong>foo\/module\/<\/strong> and source files for bar are in <strong>bar\/module\/<\/strong><\/p>\n<p>The make command in <strong>Makefile<\/strong> for <strong>foo<\/strong> probably looks like<\/p>\n<pre><code>make ARCH=$$ARCH CROSS_COMPILE=$$CROSS_COMPILE -C $$LINUX_DIR \\\n        M=`pwd`\/module \\\n        modules\n<\/code><\/pre>\n<p>(the exact line may differ in your project).<\/p>\n<p>Change it to<\/p>\n<pre><code>make ARCH=$$ARCH CROSS_COMPILE=$$CROSS_COMPILE -C $$LINUX_DIR \\\n        M=`pwd`\/module \\\n        KBUILD_EXTMOD=`pwd`\/..\/bar\/module \\\n        modules\n<\/code><\/pre>\n<p>(we added the KBUILD_EXTMOD=<code>pwd<\/code>\/..\/bar\/module \\ line, where <code>pwd<\/code>\/..\/bar\/module is a path to sources of kernel module we depend on.<\/p>\n<p>One would expect <strong>KBUILD_EXTRA_SYMBOLS<\/strong> parameter to work this way, however it&#8217;s <strong>KBUILD_EXTMOD<\/strong>.<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-27 12:26:50. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Finally, I got it. Thanks to shodanex for putting me on the right track. Update: Be very careful when applying this fix to builds for older versions of kernel, as there is a bug in Makefile.modpost file in older versions of the kernel which makes your build misbehave and build wrong targets when you specify [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1673","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1673","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1673"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1673\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}