diff options
Diffstat (limited to 'llvm/examples/Kaleidoscope/Chapter5')
-rw-r--r-- | llvm/examples/Kaleidoscope/Chapter5/CMakeLists.txt | 2 | ||||
-rw-r--r-- | llvm/examples/Kaleidoscope/Chapter5/toy.cpp | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/llvm/examples/Kaleidoscope/Chapter5/CMakeLists.txt b/llvm/examples/Kaleidoscope/Chapter5/CMakeLists.txt index b62ed410103..c0ae70654c3 100644 --- a/llvm/examples/Kaleidoscope/Chapter5/CMakeLists.txt +++ b/llvm/examples/Kaleidoscope/Chapter5/CMakeLists.txt @@ -13,3 +13,5 @@ set(LLVM_LINK_COMPONENTS add_kaleidoscope_chapter(Kaleidoscope-Ch5 toy.cpp ) + +export_executable_symbols(Kaleidoscope-Ch5) diff --git a/llvm/examples/Kaleidoscope/Chapter5/toy.cpp b/llvm/examples/Kaleidoscope/Chapter5/toy.cpp index 83af1776b20..4658edcd4ce 100644 --- a/llvm/examples/Kaleidoscope/Chapter5/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter5/toy.cpp @@ -905,14 +905,14 @@ static void MainLoop() { //===----------------------------------------------------------------------===// /// 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; } |