aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-09-15 16:47:12 +0000
committerChris Lattner <sabre@nondot.org>2003-09-15 16:47:12 +0000
commitbdbecac051601e1554aa3802f7ecff5252347716 (patch)
tree2f4d8cc98bfb803bc9d9710e032da671c83ee6d0 /lib
parentc72b249e9cb2f6c89fe3008bb8d1f49468bf5657 (diff)
downloadexternal_llvm-bdbecac051601e1554aa3802f7ecff5252347716.zip
external_llvm-bdbecac051601e1554aa3802f7ecff5252347716.tar.gz
external_llvm-bdbecac051601e1554aa3802f7ecff5252347716.tar.bz2
Fix problems with programs that prototype printf to something unusual
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8538 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/CBackend/CBackend.cpp6
-rw-r--r--lib/Target/CBackend/Writer.cpp6
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 6d1fd14..65919e8 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -987,8 +987,10 @@ void CWriter::visitUnwindInst(UnwindInst &I) {
// 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) { /* llvm.unwind */\n"
- << " printf(\"throw found with no handler!\\n\"); abort();\n"
+ Out << " if (__llvm_jmpbuf_list == 0) { /* unwind */\n"
+ << " extern write();\n"
+ << " ((void (*)(int, void*, unsigned))write)(2,\n"
+ << " \"throw found with no handler!\\n\", 31); abort();\n"
<< " }\n"
<< " longjmp(__llvm_jmpbuf_list->buf, 1);\n";
emittedInvoke = true;
diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp
index 6d1fd14..65919e8 100644
--- a/lib/Target/CBackend/Writer.cpp
+++ b/lib/Target/CBackend/Writer.cpp
@@ -987,8 +987,10 @@ void CWriter::visitUnwindInst(UnwindInst &I) {
// 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) { /* llvm.unwind */\n"
- << " printf(\"throw found with no handler!\\n\"); abort();\n"
+ Out << " if (__llvm_jmpbuf_list == 0) { /* unwind */\n"
+ << " extern write();\n"
+ << " ((void (*)(int, void*, unsigned))write)(2,\n"
+ << " \"throw found with no handler!\\n\", 31); abort();\n"
<< " }\n"
<< " longjmp(__llvm_jmpbuf_list->buf, 1);\n";
emittedInvoke = true;