[LLVMdev] Linking strncpy
Eric Zimmerman
ezimmerm at uiuc.edu
Wed Apr 14 19:03:00 PDT 2004
Hi,
I'm working on a CS326 compiler project, and I'm having some problems
using string functions. Some LLVM programs produced are either
aborting or giving incorrect results; however, if I disassemble the
LLVM bytecode and recompile with GCC, everything works fine.
I encountered the following error when running lli with
'-force-interpreter' option:
"Tried to execute an unknown external function: sbyte * (sbyte
*, sbyte *, uint) * strncpy"
Strncpy is used as part of my compiler's run-time library, and it was
compiled with the C-frontend for LLVM. Looking at the assembly, the
function is declared at the top of the file;
declare sbyte* %strncpy(sbyte*,sbyte*,uint) ;; __builtin_strncpy
And it is called like this:
%tmp.12 = call sbyte* (sbyte*, sbyte*, uint)* %strncpy(sbyte*
%tmp.15, sbyte* %tmp.23, uint %tmp.27)
What am I forgetting to do? What is the right way to link to the
string functions? Thanks,
-Eric Zimmerman
More information about the llvm-dev
mailing list