diff options
author | John Criswell <criswell@uiuc.edu> | 2003-12-10 18:06:34 +0000 |
---|---|---|
committer | John Criswell <criswell@uiuc.edu> | 2003-12-10 18:06:34 +0000 |
commit | 01b2d6131145bfa3c9c4c1598edeaac13155e1a5 (patch) | |
tree | a67a25f106f50ed62bdfd22d5129ce743a268bc9 /lib | |
parent | 7277826d7e20accb9ac433ee55546a83c1316188 (diff) | |
download | external_llvm-01b2d6131145bfa3c9c4c1598edeaac13155e1a5.zip external_llvm-01b2d6131145bfa3c9c4c1598edeaac13155e1a5.tar.gz external_llvm-01b2d6131145bfa3c9c4c1598edeaac13155e1a5.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10375 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 9 | ||||
-rw-r--r-- | lib/Target/CBackend/Writer.cpp | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index eeb2bdd..faa9b92 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -1087,13 +1087,20 @@ void CWriter::visitInvokeInst(InvokeInst &II) { 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" diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index eeb2bdd..faa9b92 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -1087,13 +1087,20 @@ void CWriter::visitInvokeInst(InvokeInst &II) { 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" |