ExternalFunctions.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. //===-- ExternalFunctions.cpp - Implement External Functions --------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file contains both code to deal with invoking "external" functions, but
  11. // also contains code that implements "exported" external functions.
  12. //
  13. // There are currently two mechanisms for handling external functions in the
  14. // Interpreter. The first is to implement lle_* wrapper functions that are
  15. // specific to well-known library functions which manually translate the
  16. // arguments from GenericValues and make the call. If such a wrapper does
  17. // not exist, and libffi is available, then the Interpreter will attempt to
  18. // invoke the function using libffi, after finding its address.
  19. //
  20. //===----------------------------------------------------------------------===//
  21. #include "Interpreter.h"
  22. #include "llvm/DerivedTypes.h"
  23. #include "llvm/Module.h"
  24. #include "llvm/Config/config.h" // Detect libffi
  25. #include "llvm/Support/ErrorHandling.h"
  26. #include "llvm/Support/Streams.h"
  27. #include "llvm/System/DynamicLibrary.h"
  28. #include "llvm/Target/TargetData.h"
  29. #include "llvm/Support/ManagedStatic.h"
  30. #include "llvm/System/Mutex.h"
  31. #include <csignal>
  32. #include <cstdio>
  33. #include <map>
  34. #include <cmath>
  35. #include <cstring>
  36. #ifdef HAVE_FFI_CALL
  37. #ifdef HAVE_FFI_H
  38. #include <ffi.h>
  39. #define USE_LIBFFI
  40. #elif HAVE_FFI_FFI_H
  41. #include <ffi/ffi.h>
  42. #define USE_LIBFFI
  43. #endif
  44. #endif
  45. using namespace llvm;
  46. static ManagedStatic<sys::Mutex> FunctionsLock;
  47. typedef GenericValue (*ExFunc)(const FunctionType *,
  48. const std::vector<GenericValue> &);
  49. static ManagedStatic<std::map<const Function *, ExFunc> > ExportedFunctions;
  50. static std::map<std::string, ExFunc> FuncNames;
  51. #ifdef USE_LIBFFI
  52. typedef void (*RawFunc)(void);
  53. static ManagedStatic<std::map<const Function *, RawFunc> > RawFunctions;
  54. #endif
  55. static Interpreter *TheInterpreter;
  56. static char getTypeID(const Type *Ty) {
  57. switch (Ty->getTypeID()) {
  58. case Type::VoidTyID: return 'V';
  59. case Type::IntegerTyID:
  60. switch (cast<IntegerType>(Ty)->getBitWidth()) {
  61. case 1: return 'o';
  62. case 8: return 'B';
  63. case 16: return 'S';
  64. case 32: return 'I';
  65. case 64: return 'L';
  66. default: return 'N';
  67. }
  68. case Type::FloatTyID: return 'F';
  69. case Type::DoubleTyID: return 'D';
  70. case Type::PointerTyID: return 'P';
  71. case Type::FunctionTyID:return 'M';
  72. case Type::StructTyID: return 'T';
  73. case Type::ArrayTyID: return 'A';
  74. case Type::OpaqueTyID: return 'O';
  75. default: return 'U';
  76. }
  77. }
  78. // Try to find address of external function given a Function object.
  79. // Please note, that interpreter doesn't know how to assemble a
  80. // real call in general case (this is JIT job), that's why it assumes,
  81. // that all external functions has the same (and pretty "general") signature.
  82. // The typical example of such functions are "lle_X_" ones.
  83. static ExFunc lookupFunction(const Function *F) {
  84. // Function not found, look it up... start by figuring out what the
  85. // composite function name should be.
  86. std::string ExtName = "lle_";
  87. const FunctionType *FT = F->getFunctionType();
  88. for (unsigned i = 0, e = FT->getNumContainedTypes(); i != e; ++i)
  89. ExtName += getTypeID(FT->getContainedType(i));
  90. ExtName + "_" + F->getNameStr();
  91. sys::ScopedLock Writer(*FunctionsLock);
  92. ExFunc FnPtr = FuncNames[ExtName];
  93. if (FnPtr == 0)
  94. FnPtr = FuncNames["lle_X_" + F->getNameStr()];
  95. if (FnPtr == 0) // Try calling a generic function... if it exists...
  96. FnPtr = (ExFunc)(intptr_t)
  97. sys::DynamicLibrary::SearchForAddressOfSymbol("lle_X_"+F->getNameStr());
  98. if (FnPtr != 0)
  99. ExportedFunctions->insert(std::make_pair(F, FnPtr)); // Cache for later
  100. return FnPtr;
  101. }
  102. #ifdef USE_LIBFFI
  103. static ffi_type *ffiTypeFor(const Type *Ty) {
  104. switch (Ty->getTypeID()) {
  105. case Type::VoidTyID: return &ffi_type_void;
  106. case Type::IntegerTyID:
  107. switch (cast<IntegerType>(Ty)->getBitWidth()) {
  108. case 8: return &ffi_type_sint8;
  109. case 16: return &ffi_type_sint16;
  110. case 32: return &ffi_type_sint32;
  111. case 64: return &ffi_type_sint64;
  112. }
  113. case Type::FloatTyID: return &ffi_type_float;
  114. case Type::DoubleTyID: return &ffi_type_double;
  115. case Type::PointerTyID: return &ffi_type_pointer;
  116. default: break;
  117. }
  118. // TODO: Support other types such as StructTyID, ArrayTyID, OpaqueTyID, etc.
  119. llvm_report_error("Type could not be mapped for use with libffi.");
  120. return NULL;
  121. }
  122. static void *ffiValueFor(const Type *Ty, const GenericValue &AV,
  123. void *ArgDataPtr) {
  124. switch (Ty->getTypeID()) {
  125. case Type::IntegerTyID:
  126. switch (cast<IntegerType>(Ty)->getBitWidth()) {
  127. case 8: {
  128. int8_t *I8Ptr = (int8_t *) ArgDataPtr;
  129. *I8Ptr = (int8_t) AV.IntVal.getZExtValue();
  130. return ArgDataPtr;
  131. }
  132. case 16: {
  133. int16_t *I16Ptr = (int16_t *) ArgDataPtr;
  134. *I16Ptr = (int16_t) AV.IntVal.getZExtValue();
  135. return ArgDataPtr;
  136. }
  137. case 32: {
  138. int32_t *I32Ptr = (int32_t *) ArgDataPtr;
  139. *I32Ptr = (int32_t) AV.IntVal.getZExtValue();
  140. return ArgDataPtr;
  141. }
  142. case 64: {
  143. int64_t *I64Ptr = (int64_t *) ArgDataPtr;
  144. *I64Ptr = (int64_t) AV.IntVal.getZExtValue();
  145. return ArgDataPtr;
  146. }
  147. }
  148. case Type::FloatTyID: {
  149. float *FloatPtr = (float *) ArgDataPtr;
  150. *FloatPtr = AV.DoubleVal;
  151. return ArgDataPtr;
  152. }
  153. case Type::DoubleTyID: {
  154. double *DoublePtr = (double *) ArgDataPtr;
  155. *DoublePtr = AV.DoubleVal;
  156. return ArgDataPtr;
  157. }
  158. case Type::PointerTyID: {
  159. void **PtrPtr = (void **) ArgDataPtr;
  160. *PtrPtr = GVTOP(AV);
  161. return ArgDataPtr;
  162. }
  163. default: break;
  164. }
  165. // TODO: Support other types such as StructTyID, ArrayTyID, OpaqueTyID, etc.
  166. llvm_report_error("Type value could not be mapped for use with libffi.");
  167. return NULL;
  168. }
  169. static bool ffiInvoke(RawFunc Fn, Function *F,
  170. const std::vector<GenericValue> &ArgVals,
  171. const TargetData *TD, GenericValue &Result) {
  172. ffi_cif cif;
  173. const FunctionType *FTy = F->getFunctionType();
  174. const unsigned NumArgs = F->arg_size();
  175. // TODO: We don't have type information about the remaining arguments, because
  176. // this information is never passed into ExecutionEngine::runFunction().
  177. if (ArgVals.size() > NumArgs && F->isVarArg()) {
  178. llvm_report_error("Calling external var arg function '" + F->getName()
  179. + "' is not supported by the Interpreter.");
  180. }
  181. unsigned ArgBytes = 0;
  182. std::vector<ffi_type*> args(NumArgs);
  183. for (Function::const_arg_iterator A = F->arg_begin(), E = F->arg_end();
  184. A != E; ++A) {
  185. const unsigned ArgNo = A->getArgNo();
  186. const Type *ArgTy = FTy->getParamType(ArgNo);
  187. args[ArgNo] = ffiTypeFor(ArgTy);
  188. ArgBytes += TD->getTypeStoreSize(ArgTy);
  189. }
  190. uint8_t *ArgData = (uint8_t*) alloca(ArgBytes);
  191. uint8_t *ArgDataPtr = ArgData;
  192. std::vector<void*> values(NumArgs);
  193. for (Function::const_arg_iterator A = F->arg_begin(), E = F->arg_end();
  194. A != E; ++A) {
  195. const unsigned ArgNo = A->getArgNo();
  196. const Type *ArgTy = FTy->getParamType(ArgNo);
  197. values[ArgNo] = ffiValueFor(ArgTy, ArgVals[ArgNo], ArgDataPtr);
  198. ArgDataPtr += TD->getTypeStoreSize(ArgTy);
  199. }
  200. const Type *RetTy = FTy->getReturnType();
  201. ffi_type *rtype = ffiTypeFor(RetTy);
  202. if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, NumArgs, rtype, &args[0]) == FFI_OK) {
  203. void *ret = NULL;
  204. if (RetTy->getTypeID() != Type::VoidTyID)
  205. ret = alloca(TD->getTypeStoreSize(RetTy));
  206. ffi_call(&cif, Fn, ret, &values[0]);
  207. switch (RetTy->getTypeID()) {
  208. case Type::IntegerTyID:
  209. switch (cast<IntegerType>(RetTy)->getBitWidth()) {
  210. case 8: Result.IntVal = APInt(8 , *(int8_t *) ret); break;
  211. case 16: Result.IntVal = APInt(16, *(int16_t*) ret); break;
  212. case 32: Result.IntVal = APInt(32, *(int32_t*) ret); break;
  213. case 64: Result.IntVal = APInt(64, *(int64_t*) ret); break;
  214. }
  215. break;
  216. case Type::FloatTyID: Result.FloatVal = *(float *) ret; break;
  217. case Type::DoubleTyID: Result.DoubleVal = *(double*) ret; break;
  218. case Type::PointerTyID: Result.PointerVal = *(void **) ret; break;
  219. default: break;
  220. }
  221. return true;
  222. }
  223. return false;
  224. }
  225. #endif // USE_LIBFFI
  226. GenericValue Interpreter::callExternalFunction(Function *F,
  227. const std::vector<GenericValue> &ArgVals) {
  228. TheInterpreter = this;
  229. FunctionsLock->acquire();
  230. // Do a lookup to see if the function is in our cache... this should just be a
  231. // deferred annotation!
  232. std::map<const Function *, ExFunc>::iterator FI = ExportedFunctions->find(F);
  233. if (ExFunc Fn = (FI == ExportedFunctions->end()) ? lookupFunction(F)
  234. : FI->second) {
  235. FunctionsLock->release();
  236. return Fn(F->getFunctionType(), ArgVals);
  237. }
  238. #ifdef USE_LIBFFI
  239. std::map<const Function *, RawFunc>::iterator RF = RawFunctions->find(F);
  240. RawFunc RawFn;
  241. if (RF == RawFunctions->end()) {
  242. RawFn = (RawFunc)(intptr_t)
  243. sys::DynamicLibrary::SearchForAddressOfSymbol(F->getName());
  244. if (RawFn != 0)
  245. RawFunctions->insert(std::make_pair(F, RawFn)); // Cache for later
  246. } else {
  247. RawFn = RF->second;
  248. }
  249. FunctionsLock->release();
  250. GenericValue Result;
  251. if (RawFn != 0 && ffiInvoke(RawFn, F, ArgVals, getTargetData(), Result))
  252. return Result;
  253. #endif // USE_LIBFFI
  254. if (F->getName() == "__main")
  255. cerr << "Tried to execute an unknown external function: "
  256. << F->getType()->getDescription() << " __main\n";
  257. else
  258. llvm_report_error("Tried to execute an unknown external function: " +
  259. F->getType()->getDescription() + " " +F->getName());
  260. return GenericValue();
  261. }
  262. //===----------------------------------------------------------------------===//
  263. // Functions "exported" to the running application...
  264. //
  265. extern "C" { // Don't add C++ manglings to llvm mangling :)
  266. // void atexit(Function*)
  267. GenericValue lle_X_atexit(const FunctionType *FT,
  268. const std::vector<GenericValue> &Args) {
  269. assert(Args.size() == 1);
  270. TheInterpreter->addAtExitHandler((Function*)GVTOP(Args[0]));
  271. GenericValue GV;
  272. GV.IntVal = 0;
  273. return GV;
  274. }
  275. // void exit(int)
  276. GenericValue lle_X_exit(const FunctionType *FT,
  277. const std::vector<GenericValue> &Args) {
  278. TheInterpreter->exitCalled(Args[0]);
  279. return GenericValue();
  280. }
  281. // void abort(void)
  282. GenericValue lle_X_abort(const FunctionType *FT,
  283. const std::vector<GenericValue> &Args) {
  284. //FIXME: should we report or raise here?
  285. //llvm_report_error("Interpreted program raised SIGABRT");
  286. raise (SIGABRT);
  287. return GenericValue();
  288. }
  289. // int sprintf(char *, const char *, ...) - a very rough implementation to make
  290. // output useful.
  291. GenericValue lle_X_sprintf(const FunctionType *FT,
  292. const std::vector<GenericValue> &Args) {
  293. char *OutputBuffer = (char *)GVTOP(Args[0]);
  294. const char *FmtStr = (const char *)GVTOP(Args[1]);
  295. unsigned ArgNo = 2;
  296. // printf should return # chars printed. This is completely incorrect, but
  297. // close enough for now.
  298. GenericValue GV;
  299. GV.IntVal = APInt(32, strlen(FmtStr));
  300. while (1) {
  301. switch (*FmtStr) {
  302. case 0: return GV; // Null terminator...
  303. default: // Normal nonspecial character
  304. sprintf(OutputBuffer++, "%c", *FmtStr++);
  305. break;
  306. case '\\': { // Handle escape codes
  307. sprintf(OutputBuffer, "%c%c", *FmtStr, *(FmtStr+1));
  308. FmtStr += 2; OutputBuffer += 2;
  309. break;
  310. }
  311. case '%': { // Handle format specifiers
  312. char FmtBuf[100] = "", Buffer[1000] = "";
  313. char *FB = FmtBuf;
  314. *FB++ = *FmtStr++;
  315. char Last = *FB++ = *FmtStr++;
  316. unsigned HowLong = 0;
  317. while (Last != 'c' && Last != 'd' && Last != 'i' && Last != 'u' &&
  318. Last != 'o' && Last != 'x' && Last != 'X' && Last != 'e' &&
  319. Last != 'E' && Last != 'g' && Last != 'G' && Last != 'f' &&
  320. Last != 'p' && Last != 's' && Last != '%') {
  321. if (Last == 'l' || Last == 'L') HowLong++; // Keep track of l's
  322. Last = *FB++ = *FmtStr++;
  323. }
  324. *FB = 0;
  325. switch (Last) {
  326. case '%':
  327. strcpy(Buffer, "%"); break;
  328. case 'c':
  329. sprintf(Buffer, FmtBuf, uint32_t(Args[ArgNo++].IntVal.getZExtValue()));
  330. break;
  331. case 'd': case 'i':
  332. case 'u': case 'o':
  333. case 'x': case 'X':
  334. if (HowLong >= 1) {
  335. if (HowLong == 1 &&
  336. TheInterpreter->getTargetData()->getPointerSizeInBits() == 64 &&
  337. sizeof(long) < sizeof(int64_t)) {
  338. // Make sure we use %lld with a 64 bit argument because we might be
  339. // compiling LLI on a 32 bit compiler.
  340. unsigned Size = strlen(FmtBuf);
  341. FmtBuf[Size] = FmtBuf[Size-1];
  342. FmtBuf[Size+1] = 0;
  343. FmtBuf[Size-1] = 'l';
  344. }
  345. sprintf(Buffer, FmtBuf, Args[ArgNo++].IntVal.getZExtValue());
  346. } else
  347. sprintf(Buffer, FmtBuf,uint32_t(Args[ArgNo++].IntVal.getZExtValue()));
  348. break;
  349. case 'e': case 'E': case 'g': case 'G': case 'f':
  350. sprintf(Buffer, FmtBuf, Args[ArgNo++].DoubleVal); break;
  351. case 'p':
  352. sprintf(Buffer, FmtBuf, (void*)GVTOP(Args[ArgNo++])); break;
  353. case 's':
  354. sprintf(Buffer, FmtBuf, (char*)GVTOP(Args[ArgNo++])); break;
  355. default: cerr << "<unknown printf code '" << *FmtStr << "'!>";
  356. ArgNo++; break;
  357. }
  358. strcpy(OutputBuffer, Buffer);
  359. OutputBuffer += strlen(Buffer);
  360. }
  361. break;
  362. }
  363. }
  364. return GV;
  365. }
  366. // int printf(const char *, ...) - a very rough implementation to make output
  367. // useful.
  368. GenericValue lle_X_printf(const FunctionType *FT,
  369. const std::vector<GenericValue> &Args) {
  370. char Buffer[10000];
  371. std::vector<GenericValue> NewArgs;
  372. NewArgs.push_back(PTOGV((void*)&Buffer[0]));
  373. NewArgs.insert(NewArgs.end(), Args.begin(), Args.end());
  374. GenericValue GV = lle_X_sprintf(FT, NewArgs);
  375. cout << Buffer;
  376. return GV;
  377. }
  378. static void ByteswapSCANFResults(const char *Fmt, void *Arg0, void *Arg1,
  379. void *Arg2, void *Arg3, void *Arg4, void *Arg5,
  380. void *Arg6, void *Arg7, void *Arg8) {
  381. void *Args[] = { Arg0, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, 0 };
  382. // Loop over the format string, munging read values as appropriate (performs
  383. // byteswaps as necessary).
  384. unsigned ArgNo = 0;
  385. while (*Fmt) {
  386. if (*Fmt++ == '%') {
  387. // Read any flag characters that may be present...
  388. bool Suppress = false;
  389. bool Half = false;
  390. bool Long = false;
  391. bool LongLong = false; // long long or long double
  392. while (1) {
  393. switch (*Fmt++) {
  394. case '*': Suppress = true; break;
  395. case 'a': /*Allocate = true;*/ break; // We don't need to track this
  396. case 'h': Half = true; break;
  397. case 'l': Long = true; break;
  398. case 'q':
  399. case 'L': LongLong = true; break;
  400. default:
  401. if (Fmt[-1] > '9' || Fmt[-1] < '0') // Ignore field width specs
  402. goto Out;
  403. }
  404. }
  405. Out:
  406. // Read the conversion character
  407. if (!Suppress && Fmt[-1] != '%') { // Nothing to do?
  408. unsigned Size = 0;
  409. const Type *Ty = 0;
  410. switch (Fmt[-1]) {
  411. case 'i': case 'o': case 'u': case 'x': case 'X': case 'n': case 'p':
  412. case 'd':
  413. if (Long || LongLong) {
  414. Size = 8; Ty = Type::Int64Ty;
  415. } else if (Half) {
  416. Size = 4; Ty = Type::Int16Ty;
  417. } else {
  418. Size = 4; Ty = Type::Int32Ty;
  419. }
  420. break;
  421. case 'e': case 'g': case 'E':
  422. case 'f':
  423. if (Long || LongLong) {
  424. Size = 8; Ty = Type::DoubleTy;
  425. } else {
  426. Size = 4; Ty = Type::FloatTy;
  427. }
  428. break;
  429. case 's': case 'c': case '[': // No byteswap needed
  430. Size = 1;
  431. Ty = Type::Int8Ty;
  432. break;
  433. default: break;
  434. }
  435. if (Size) {
  436. GenericValue GV;
  437. void *Arg = Args[ArgNo++];
  438. memcpy(&GV, Arg, Size);
  439. TheInterpreter->StoreValueToMemory(GV, (GenericValue*)Arg, Ty);
  440. }
  441. }
  442. }
  443. }
  444. }
  445. // int sscanf(const char *format, ...);
  446. GenericValue lle_X_sscanf(const FunctionType *FT,
  447. const std::vector<GenericValue> &args) {
  448. assert(args.size() < 10 && "Only handle up to 10 args to sscanf right now!");
  449. char *Args[10];
  450. for (unsigned i = 0; i < args.size(); ++i)
  451. Args[i] = (char*)GVTOP(args[i]);
  452. GenericValue GV;
  453. GV.IntVal = APInt(32, sscanf(Args[0], Args[1], Args[2], Args[3], Args[4],
  454. Args[5], Args[6], Args[7], Args[8], Args[9]));
  455. ByteswapSCANFResults(Args[1], Args[2], Args[3], Args[4],
  456. Args[5], Args[6], Args[7], Args[8], Args[9], 0);
  457. return GV;
  458. }
  459. // int scanf(const char *format, ...);
  460. GenericValue lle_X_scanf(const FunctionType *FT,
  461. const std::vector<GenericValue> &args) {
  462. assert(args.size() < 10 && "Only handle up to 10 args to scanf right now!");
  463. char *Args[10];
  464. for (unsigned i = 0; i < args.size(); ++i)
  465. Args[i] = (char*)GVTOP(args[i]);
  466. GenericValue GV;
  467. GV.IntVal = APInt(32, scanf( Args[0], Args[1], Args[2], Args[3], Args[4],
  468. Args[5], Args[6], Args[7], Args[8], Args[9]));
  469. ByteswapSCANFResults(Args[0], Args[1], Args[2], Args[3], Args[4],
  470. Args[5], Args[6], Args[7], Args[8], Args[9]);
  471. return GV;
  472. }
  473. // int fprintf(FILE *, const char *, ...) - a very rough implementation to make
  474. // output useful.
  475. GenericValue lle_X_fprintf(const FunctionType *FT,
  476. const std::vector<GenericValue> &Args) {
  477. assert(Args.size() >= 2);
  478. char Buffer[10000];
  479. std::vector<GenericValue> NewArgs;
  480. NewArgs.push_back(PTOGV(Buffer));
  481. NewArgs.insert(NewArgs.end(), Args.begin()+1, Args.end());
  482. GenericValue GV = lle_X_sprintf(FT, NewArgs);
  483. fputs(Buffer, (FILE *) GVTOP(Args[0]));
  484. return GV;
  485. }
  486. } // End extern "C"
  487. void Interpreter::initializeExternalFunctions() {
  488. sys::ScopedLock Writer(*FunctionsLock);
  489. FuncNames["lle_X_atexit"] = lle_X_atexit;
  490. FuncNames["lle_X_exit"] = lle_X_exit;
  491. FuncNames["lle_X_abort"] = lle_X_abort;
  492. FuncNames["lle_X_printf"] = lle_X_printf;
  493. FuncNames["lle_X_sprintf"] = lle_X_sprintf;
  494. FuncNames["lle_X_sscanf"] = lle_X_sscanf;
  495. FuncNames["lle_X_scanf"] = lle_X_scanf;
  496. FuncNames["lle_X_fprintf"] = lle_X_fprintf;
  497. }