Mark function used by asm block as used, otherwise optimizer may not see the use...
authorDevang Patel <dpatel@apple.com>
Wed, 16 Jul 2008 17:54:34 +0000 (17:54 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 16 Jul 2008 17:54:34 +0000 (17:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53692 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/Compiler.h
lib/Target/X86/X86JITInfo.cpp

index 1497dd61edee9a3e0d1b9fb88fcf451a402925b0..9750579f2c25369522cb42cc751e5e58da1aeb36 100644 (file)
 #define VISIBILITY_HIDDEN
 #endif
 
+#if (__GNUC__ >= 4)
+#define ATTRIBUTE_USED __attribute__((__used__))
+#else
+#define ATTRIBUTE_USED
+#endif
 
 // C++ doesn't support 'extern template' of template specializations.  GCC does,
 // but requires __extension__ before it.  In the header, use this:
index 0cda7d3a43a576760a6e1fb07c9906de25cd3240..f7d1118d7007ec16701e44ad44eb35d857e38382 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/Function.h"
 #include "llvm/CodeGen/MachineCodeEmitter.h"
 #include "llvm/Config/alloca.h"
+#include "llvm/Support/Compiler.h"
 #include <cstdlib>
 #include <cstring>
 using namespace llvm;
@@ -315,7 +316,8 @@ extern "C" {
 /// function stub when we did not know the real target of a call.  This function
 /// must locate the start of the stub or call site and pass it into the JIT
 /// compiler function.
-extern "C" void X86CompilationCallback2(intptr_t *StackPtr, intptr_t RetAddr) {
+extern "C" void ATTRIBUTE_USED
+X86CompilationCallback2(intptr_t *StackPtr, intptr_t RetAddr) {
   intptr_t *RetAddrLoc = &StackPtr[1];
   assert(*RetAddrLoc == RetAddr &&
          "Could not find return address on the stack!");