[llvm-commits] [parallel] CVS: llvm/lib/ExecutionEngine/JIT/Intercept.cpp

Misha Brukman brukman at cs.uiuc.edu
Wed Mar 10 19:34:07 PST 2004


Changes in directory llvm/lib/ExecutionEngine/JIT:

Intercept.cpp updated: 1.13 -> 1.13.2.1

---
Log message:

Merge from trunk.

---
Diffs of the changes:  (+20 -0)

Index: llvm/lib/ExecutionEngine/JIT/Intercept.cpp
diff -u llvm/lib/ExecutionEngine/JIT/Intercept.cpp:1.13 llvm/lib/ExecutionEngine/JIT/Intercept.cpp:1.13.2.1
--- llvm/lib/ExecutionEngine/JIT/Intercept.cpp:1.13	Fri Dec 26 00:13:47 2003
+++ llvm/lib/ExecutionEngine/JIT/Intercept.cpp	Wed Mar 10 19:33:44 2004
@@ -18,6 +18,7 @@
 #include "JIT.h"
 #include "Support/DynamicLinker.h"
 #include <iostream>
+#include <sys/stat.h>
 using namespace llvm;
 
 // AtExitHandlers - List of functions to call when the program exits,
@@ -39,6 +40,25 @@
 //===----------------------------------------------------------------------===//
 // Function stubs that are invoked instead of certain library calls
 //===----------------------------------------------------------------------===//
+
+// Force the following functions to be linked in to anything that uses the
+// JIT. This is a hack designed to work around the all-too-clever Glibc
+// strategy of making these functions work differently when inlined vs. when
+// not inlined, and hiding their real definitions in a separate archive file
+// that the dynamic linker can't see. For more info, search for
+// 'libc_nonshared.a' on Google, or read http://llvm.cs.uiuc.edu/PR274.
+#if defined(__linux__)
+void *FunctionPointers[] = {
+  (void *) stat,
+  (void *) fstat,
+  (void *) lstat,
+  (void *) stat64,
+  (void *) fstat64,
+  (void *) lstat64,
+  (void *) atexit,
+  (void *) mknod
+};
+#endif // __linux__
 
 // NoopFn - Used if we have nothing else to call...
 static void NoopFn() {}





More information about the llvm-commits mailing list