summaryrefslogtreecommitdiffstats
path: root/llvm/examples
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2015-08-27 20:31:44 +0000
committerLang Hames <lhames@gmail.com>2015-08-27 20:31:44 +0000
commitd76e06715056710199bb74b4582e9c343a252aeb (patch)
tree2b38d78b6a77bbf4c08f576a8844583cef78f61d /llvm/examples
parenta79dfb3223289498498f695e0b2d248031b00766 (diff)
downloadbcm5719-llvm-d76e06715056710199bb74b4582e9c343a252aeb.tar.gz
bcm5719-llvm-d76e06715056710199bb74b4582e9c343a252aeb.zip
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
Diffstat (limited to 'llvm/examples')
-rw-r--r--llvm/examples/Kaleidoscope/Chapter4/CMakeLists.txt2
-rw-r--r--llvm/examples/Kaleidoscope/Chapter4/toy.cpp8
-rw-r--r--llvm/examples/Kaleidoscope/Chapter5/CMakeLists.txt2
-rw-r--r--llvm/examples/Kaleidoscope/Chapter5/toy.cpp8
-rw-r--r--llvm/examples/Kaleidoscope/Chapter6/CMakeLists.txt2
-rw-r--r--llvm/examples/Kaleidoscope/Chapter6/toy.cpp8
-rw-r--r--llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt2
-rw-r--r--llvm/examples/Kaleidoscope/Chapter7/toy.cpp8
-rw-r--r--llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt2
-rw-r--r--llvm/examples/Kaleidoscope/Chapter8/toy.cpp8
10 files changed, 30 insertions, 20 deletions
diff --git a/llvm/examples/Kaleidoscope/Chapter4/CMakeLists.txt b/llvm/examples/Kaleidoscope/Chapter4/CMakeLists.txt
index 44e1aeecaae..89feed143ad 100644
--- a/llvm/examples/Kaleidoscope/Chapter4/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/Chapter4/CMakeLists.txt
@@ -13,3 +13,5 @@ set(LLVM_LINK_COMPONENTS
add_kaleidoscope_chapter(Kaleidoscope-Ch4
toy.cpp
)
+
+export_executable_symbols(Kaleidoscope-Ch4)
diff --git a/llvm/examples/Kaleidoscope/Chapter4/toy.cpp b/llvm/examples/Kaleidoscope/Chapter4/toy.cpp
index 12777ae2c75..fe8ec17b4e8 100644
--- a/llvm/examples/Kaleidoscope/Chapter4/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter4/toy.cpp
@@ -631,14 +631,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;
}
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;
}
diff --git a/llvm/examples/Kaleidoscope/Chapter6/CMakeLists.txt b/llvm/examples/Kaleidoscope/Chapter6/CMakeLists.txt
index 6bb2b193752..49627f07ddf 100644
--- a/llvm/examples/Kaleidoscope/Chapter6/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/Chapter6/CMakeLists.txt
@@ -13,3 +13,5 @@ set(LLVM_LINK_COMPONENTS
add_kaleidoscope_chapter(Kaleidoscope-Ch6
toy.cpp
)
+
+export_executable_symbols(Kaleidoscope-Ch6)
diff --git a/llvm/examples/Kaleidoscope/Chapter6/toy.cpp b/llvm/examples/Kaleidoscope/Chapter6/toy.cpp
index e1bed45189e..9d9914a4b89 100644
--- a/llvm/examples/Kaleidoscope/Chapter6/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter6/toy.cpp
@@ -1023,14 +1023,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;
}
diff --git a/llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt b/llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt
index 27c18cdd065..e67d7928efe 100644
--- a/llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/Chapter7/CMakeLists.txt
@@ -13,3 +13,5 @@ set(LLVM_LINK_COMPONENTS
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 4558522952c..d61d880e540 100644
--- a/llvm/examples/Kaleidoscope/Chapter7/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter7/toy.cpp
@@ -1189,14 +1189,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;
}
diff --git a/llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt b/llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt
index e335cb48ac7..d9b5cc421be 100644
--- a/llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt
+++ b/llvm/examples/Kaleidoscope/Chapter8/CMakeLists.txt
@@ -9,3 +9,5 @@ set(LLVM_LINK_COMPONENTS
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 7338c6ebc50..5f97a157336 100644
--- a/llvm/examples/Kaleidoscope/Chapter8/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter8/toy.cpp
@@ -1383,14 +1383,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;
}
OpenPOWER on IntegriCloud