summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2017-07-12 19:33:30 +0000
committerPetr Hosek <phosek@chromium.org>2017-07-12 19:33:30 +0000
commit739a23efa7d57772b9a1aa509c3489b520a09c4e (patch)
treeec2811b055b520fc9a7b5af78518b0ba8b9dd97d
parent880288aa6e7e6499b590fe792a16edec3193645a (diff)
downloadcompiler-rt-739a23efa7d57772b9a1aa509c3489b520a09c4e.tar.gz
[builtins] Better Fuchsia support
Add Fuchsia support to some builtings and avoid building builtins that are not and will never be used on Fuchsia. Differential Revision: https://reviews.llvm.org/D34075 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307832 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/builtins/CMakeLists.txt13
-rw-r--r--lib/builtins/int_util.c10
2 files changed, 19 insertions, 4 deletions
diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt
index 6556e7ac6..f0d3f5071 100644
--- a/lib/builtins/CMakeLists.txt
+++ b/lib/builtins/CMakeLists.txt
@@ -44,7 +44,6 @@ set(GENERIC_SOURCES
ashrti3.c
bswapdi2.c
bswapsi2.c
- clear_cache.c
clzdi2.c
clzsi2.c
clzti2.c
@@ -68,7 +67,6 @@ set(GENERIC_SOURCES
divti3.c
divtf3.c
divxc3.c
- eprintf.c
extendsfdf2.c
extendhfsf2.c
ffsdi2.c
@@ -191,11 +189,12 @@ option(COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN
"Skip the atomic builtin (this may be needed if system headers are unavailable)"
Off)
-if(NOT COMPILER_RT_BAREMETAL_BUILD)
+if(NOT FUCHSIA AND NOT COMPILER_RT_BAREMETAL_BUILD)
set(GENERIC_SOURCES
${GENERIC_SOURCES}
emutls.c
- enable_execute_stack.c)
+ enable_execute_stack.c
+ eprintf.c)
endif()
if(COMPILER_RT_HAS_ATOMIC_KEYWORD AND NOT COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN)
@@ -221,6 +220,12 @@ if (HAVE_UNWIND_H)
gcc_personality_v0.c)
endif ()
+if (NOT FUCHSIA)
+ set(GENERIC_SOURCES
+ ${GENERIC_SOURCES}
+ clear_cache.c)
+endif()
+
if (NOT MSVC)
set(x86_64_SOURCES
x86_64/chkstk.S
diff --git a/lib/builtins/int_util.c b/lib/builtins/int_util.c
index 420d1e237..de87410db 100644
--- a/lib/builtins/int_util.c
+++ b/lib/builtins/int_util.c
@@ -45,6 +45,16 @@ void compilerrt_abort_impl(const char *file, int line, const char *function) {
__assert_rtn(function, file, line, "libcompiler_rt abort");
}
+#elif __Fuchsia__
+
+#ifndef _WIN32
+__attribute__((weak))
+__attribute__((visibility("hidden")))
+#endif
+void compilerrt_abort_impl(const char *file, int line, const char *function) {
+ __builtin_trap();
+}
+
#else
/* Get the system definition of abort() */