{"id":993,"date":"2022-08-30T15:10:36","date_gmt":"2022-08-30T15:10:36","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/undefined-reference-on-linked-in-assembly-function-closed-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:10:36","modified_gmt":"2022-08-30T15:10:36","slug":"undefined-reference-on-linked-in-assembly-function-closed-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/undefined-reference-on-linked-in-assembly-function-closed-collection-of-common-programming-errors\/","title":{"rendered":"Undefined reference on linked in assembly function [closed]-Collection of common programming errors"},"content":{"rendered":"<p>I am trying to compile my kernel, but at link time I get:<\/p>\n<blockquote>\n<p>DescriptorTables.cpp:(.text+0x123): undefined reference to `gdt_flush(unsigned int)&#8217;<\/p>\n<\/blockquote>\n<p><code>gdt_flush<\/code> is a function in an external assembler file that gets linked with DescriptorTables.cpp. This is unusual because it is declared as global in asm, and external in C++ (<code>extern<\/code>).<\/p>\n<p>Could this be possible because g++ is looking for a function that takes an argument, and <code>gdt_flush<\/code> is looking at the <code>eax<\/code> register for its parameter?<\/p>\n<p>Update: I figured it out, g++ was calling it as a c++ style call, not a c (plain) call. I just had to put <code>extern \"C\" ...<\/code> in front of the function to make it callable.<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:11:51. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I am trying to compile my kernel, but at link time I get: DescriptorTables.cpp:(.text+0x123): undefined reference to `gdt_flush(unsigned int)&#8217; gdt_flush is a function in an external assembler file that gets linked with DescriptorTables.cpp. This is unusual because it is declared as global in asm, and external in C++ (extern). Could this be possible because g++ [&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-993","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/993","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=993"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/993\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}