Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7690 Discussions

undefined reference to `_intel_fast_memcpy' when using intrinsics

I am using vxWorks on Pentium4. My application is computation intensive. I want to operate on 128 bit at a time. So I am using intrinsics provided by Intel compiler (_mm_load_si128, _mm_xor_si128). My code includes socket and timer signalfunctionality of vxWorks and do computation on received data as well.
I have devided the code in 2 parts.
1. VxWorks system call specific code
2. Simple C code for computation
I am compilingcomputation specific code on Linux Intel compiler8.0and generating object code for that, and vxWorks system call specific code with gnu toolchain provided in Tornado2.2.
If I do not use intrinsics to operate on 128 bits, I am able to link the intel generated code with with gnu generated code. But when I use intrinsics I am getting undefined reference to `_intel_fast_memcpy' error at linking time.
Please help
0 Kudos
1 Reply

The ReleaseNotes actually mentioned this specific problem. See below for the details. All you need to do is to use IntelC's linker.


Fast Memory Copy Routines

The following is only an issue if you are not linking against the standard Intel libraries, either as a result of specifying -nostdlib on the command line or as a result of calling the linker directly rather than from the Intel C++ Compiler driver.

The Intel C++ Compiler uses two routines _intel_fast_memcpy and _intel_fast_memset to perform memcpy and memset operations that are not macro expanded to __builtin_memcpy and __builtin_memset in the source code. These are found in libirc. If you use the gcc compiler to link your application or if you directly call the linker, ld, you might find these unresolved symbols. For this reason, Intel recomends using the Intel C++ Compiler for linking, using the same compiler options used during the compilation phase. However, if you see these as undefined externals, either add -lirc to your link line, or change your includes so that memcpy and memset will be macro expanded to the builtin forms and recompile. The Intel C++ Compiler for IA-32 based applications calls a routine intel_proc_init from the main routine of any program to ensure that the processor is correctly set up. This routine is also found in libirc. These routines used further entry points from glibc, so -lirc needs to be placed before -lc on your command line.