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/Chapter7/CMakeLists.txt b/llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt
index 27c18cd..e67d792 100644
--- a/llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt
@@ -13,3 +13,5 @@
add_kaleidoscope_chapter(Kaleidoscope-Ch7
toy.cpp
)
+
+export_executable_symbols(Kaleidoscope-Ch7)
diff --git a/llvm/examples/Kaleidoscope/Chapter7/toy.cpp b/llvm/examples/Kaleidoscope/Chapter7/toy.cpp
index 4558522..d61d880 100644
--- a/llvm/examples/Kaleidoscope/Chapter7/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter7/toy.cpp
@@ -1189,14 +1189,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;
}