[llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp

John Criswell criswell at cs.uiuc.edu
Wed Dec 10 12:07:01 PST 2003


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.148 -> 1.149

---
Log message:

Fixed the CBE on Solaris/Sparc.  We need to define the return value of
the write() system call because it returns 64 bits on Solaris 64 bit,
and an implicit return value of int says it returns 32 bits.
Admittedly, this is a bit of a hack.




---
Diffs of the changes:  (+8 -1)

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.148 llvm/lib/CWriter/Writer.cpp:1.149
--- llvm/lib/CWriter/Writer.cpp:1.148	Tue Nov 25 18:09:17 2003
+++ llvm/lib/CWriter/Writer.cpp	Wed Dec 10 12:06:34 2003
@@ -1087,13 +1087,20 @@
 
 
 void CWriter::visitUnwindInst(UnwindInst &I) {
+  // Determine the return size of write() based on the data model.
+#ifdef _LP64
+      const char * writedecl = "    extern signed long long write();\n";
+#else
+      const char * writedecl = "    extern write();\n";
+#endif
+
   // The unwind instructions causes a control flow transfer out of the current
   // function, unwinding the stack until a caller who used the invoke
   // instruction is found.  In this context, we code generated the invoke
   // instruction to add an entry to the top of the jmpbuf_list.  Thus, here we
   // just have to longjmp to the specified handler.
   Out << "  if (__llvm_jmpbuf_list == 0) {  /* unwind */\n"
-      << "    extern write();\n"
+      << writedecl
       << "    ((void (*)(int, void*, unsigned))write)(2,\n"
       << "           \"throw found with no handler!\\n\", 31); abort();\n"
       << "  }\n"





More information about the llvm-commits mailing list