Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Problem to build kernel-mode driver

Peter_Skvarka
Beginner
747 Views
Hi,

I am trying to build x86 kernel-mode driver. Last link error which appears was:
error LNK2001: unresolved external symbol __intel_fast_memcpy

error LNK2001: unresolved external symbol __intel_fast_memset

So I tried to add libirc.lib into libraries in linker preferences. Another two unresolved symbols appears:
libirc.lib(proc_init.obj) : error LNK2019: unresolved external symbol _exit referenced in function ___intel_proc_init_N.A
libirc.lib(irc_msg_support.obj) : error LNK2019: unresolved external symbol _printf referenced in function _irc__print

Both fucntions are not needed in kernel mode driver.
Only way how to resolve both is to add msvcrt.lib (or some other ms crt) or to define my own empty function body for them. I was successful to define _printf() but not successful to define _exit, I tried it by declaration in MS headers but I dont know why it still complains that it is not defined....
So I tried to add msvcrt.lib and successfuly built driver.
Result is that driver dynamically links to user-mode dll (mscvr80.dll) which makes it unusable.
Such kernel driver then cannot be loaded into system.

Are available source files for __intel_fast_memcpy and __intel_fast_memset ? I think this should be solution for me.
If not
Does not exist some doc or articles about building kernel-mode drivers ? Maybe I need some special Intel compiler switches.
Or any other tip how to resolve __intel_fast_memcpy and __intel_fast_memset for kernel-mode driver.

Thanks !
Peter

0 Kudos
5 Replies
Feilong_H_Intel
Employee
747 Views
Quoting - Peter Skvarka
Hi,

I am trying to build x86 kernel-mode driver. Last link error which appears was:
error LNK2001: unresolved external symbol __intel_fast_memcpy

error LNK2001: unresolved external symbol __intel_fast_memset

So I tried to add libirc.lib into libraries in linker preferences. Another two unresolved symbols appears:
libirc.lib(proc_init.obj) : error LNK2019: unresolved external symbol _exit referenced in function ___intel_proc_init_N.A
libirc.lib(irc_msg_support.obj) : error LNK2019: unresolved external symbol _printf referenced in function _irc__print

Both fucntions are not needed in kernel mode driver.
Only way how to resolve both is to add msvcrt.lib (or some other ms crt) or to define my own empty function body for them. I was successful to define _printf() but not successful to define _exit, I tried it by declaration in MS headers but I dont know why it still complains that it is not defined....
So I tried to add msvcrt.lib and successfuly built driver.
Result is that driver dynamically links to user-mode dll (mscvr80.dll) which makes it unusable.
Such kernel driver then cannot be loaded into system.

Are available source files for __intel_fast_memcpy and __intel_fast_memset ? I think this should be solution for me.
If not
Does not exist some doc or articles about building kernel-mode drivers ? Maybe I need some special Intel compiler switches.
Or any other tip how to resolve __intel_fast_memcpy and __intel_fast_memset for kernel-mode driver.

Thanks !
Peter


Hi Peter,

You need to link libirc_s.a instead of libirc.a. Please let me know if this solves the problem.

Thank you.
--
Feilong H.
Intel Developer Support

Tools Knowledge Base: http://software.intel.com/en-us/articles/tools
0 Kudos
Peter_Skvarka
Beginner
747 Views
Hi,
sorry for several days delay,

I am trying to find libirc_s.lib in my "Program FilesIntel" directory tree by your recommendation
but I have there only:

libirc.lib
libircmt.lib

Where can I find libirc_s.lib,which packageneeded to install ?
Does existsomeIntel software productfor building kernel drivers ?

Thanks !
Peter

0 Kudos
Feilong_H_Intel
Employee
747 Views


Peter,

I'm sorry that I thought you were seeing this problem on Linux, when I saw you talked about "kernel-mode". libirc_s.a is a lib in icc package for Linux.

For Windows, please try /Oi- option, which inhibits the compiler from inline expansion of intrinsic functions. Please let me know if you still see undefined reference to __intel_fast_memcpy with /Oi-.

0 Kudos
Peter_Skvarka
Beginner
747 Views
Thanks,
yes, it is compilable now even without libirc.lib when I use /Oi- .
But I'd like to use Intel quick intrisics because the reason why I try Intel compiler is speed enhancements.
So second option which Iam successful withis creating simple *.lib and put only empty functions _exit and _printf into it. It seems this solution also works. I also appear something similar in your ipp-samples - there exist for kernel-mode driver _exit and other functions created in *.c source and included intoWindows makefile.

I hope that second solution even there is libirc.lib in kernel-mode driver code ?Does exist some articles/manuals for kernel-mode development with Intel compiler + Intel devel tools ?

Peter

0 Kudos
levicki
Valued Contributor I
747 Views
Quoting - Peter Skvarka
Thanks,
yes, it is compilable now even without libirc.lib when I use /Oi- .
But I'd like to use Intel quick intrisics because the reason why I try Intel compiler is speed enhancements.
So second option which Iam successful withis creating simple *.lib and put only empty functions _exit and _printf into it. It seems this solution also works. I also appear something similar in your ipp-samples - there exist for kernel-mode driver _exit and other functions created in *.c source and included intoWindows makefile.

I hope that second solution even there is libirc.lib in kernel-mode driver code ?Does exist some articles/manuals for kernel-mode development with Intel compiler + Intel devel tools ?

Peter


In my opinion the real issue here (and the one I thought of submitting to Premier Support few days ago) is this CPU detection rutine which insists on bringing printf with it whether you build console or GUI app or static library or a DLL or in this case a driver. I believe that there should be a "quiet" version of the CPU detection function which only returns an error code without attempting to printf anything.

0 Kudos
Reply