Recommit r246175 - Add Kaleidoscope regression tests, with a fix to make sure
the kaleidoscope 'library' functions aren't dead-stripped in release builds.
llvm-svn: 246201
diff --git a/llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt b/llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt
index e335cb4..d9b5cc4 100644
--- a/llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt
@@ -9,3 +9,5 @@
add_kaleidoscope_chapter(Kaleidoscope-Ch8
toy.cpp
)
+
+export_executable_symbols(Kaleidoscope-Ch8)
diff --git a/llvm/examples/Kaleidoscope/Chapter8/toy.cpp b/llvm/examples/Kaleidoscope/Chapter8/toy.cpp
index 7338c6e..5f97a15 100644
--- a/llvm/examples/Kaleidoscope/Chapter8/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter8/toy.cpp
@@ -1383,14 +1383,14 @@
//===----------------------------------------------------------------------===//
/// putchard - putchar that takes a double and returns 0.
-extern "C" double putchard(double X) {
- putchar((char)X);
+__attribute__((used)) extern "C" double putchard(double X) {
+ fputc((char)X, stderr);
return 0;
}
/// printd - printf that takes a double prints it as "%f\n", returning 0.
-extern "C" double printd(double X) {
- printf("%f\n", X);
+__attribute__((used)) extern "C" double printd(double X) {
+ fprintf(stderr, "%f\n", X);
return 0;
}