summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-31 17:00:48 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-31 17:00:48 +0000
commitd3d22631ca0b314f0564a9bcfe96dd2d6ca85fa6 (patch)
tree769c0aff878accac1216a06b777b0abb0b3180f6
parent48f46ac1d9a82210f6e469567cb60aa7e7cd2f3b (diff)
downloadcompiler-rt-d3d22631ca0b314f0564a9bcfe96dd2d6ca85fa6.tar.gz
Add new build option KERNEL_USE, which compiles with -mkernel and gets propogated to CFLAGS. Use this to call panic() instead of abort() when enabled.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@100015 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Makefile8
-rw-r--r--lib/int_lib.h7
-rw-r--r--make/lib_info.mk3
-rw-r--r--make/platform/clang_darwin.mk2
4 files changed, 18 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 95c02a666..530590618 100644
--- a/Makefile
+++ b/Makefile
@@ -206,10 +206,16 @@ $(call Set,Tmp.ObjPath,$(ProjObjRoot)/$(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch)/$(Tm
$(call Set,Tmp.Dependencies,$($(Tmp.SubDirKey).Dependencies))
$(call Set,Tmp.CC,$(strip \
$(call GetCNAVar,CC,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
+$(call Set,Tmp.KERNEL_USE,$(strip \
+ $(call GetCNAVar,KERNEL_USE,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
+$(call Set,Tmp.VISIBILITY_HIDDEN,$(strip \
+ $(call GetCNAVar,VISIBILITY_HIDDEN,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
$(call Set,Tmp.CFLAGS,$(strip \
$(if $(call IsDefined,$(Tmp.Key).UniversalArchs),-arch $(Tmp.Arch),)\
- $(if $(call streq,$($(Tmp.Key).VISIBILITY_HIDDEN),1),\
+ $(if $(call streq,$(Tmp.VISIBILITY_HIDDEN),1),\
-fvisibility=hidden -DVISIBILITY_HIDDEN,)\
+ $(if $(call streq,$(Tmp.KERNEL_USE),1),\
+ -mkernel -DKERNEL_USE,)\
$(call GetCNAVar,CFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
$(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.s $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir
diff --git a/lib/int_lib.h b/lib/int_lib.h
index f6c2dd45e..912a12f59 100644
--- a/lib/int_lib.h
+++ b/lib/int_lib.h
@@ -23,7 +23,14 @@
#include "endianness.h"
#include <math.h>
+/* If compiling for kernel use, call panic() instead of abort(). */
+#ifdef KERNEL_USE
+extern void panic (const char *, ...);
+#define compilerrt_abort() \
+ panic("%s:%d: abort in %s", __FILE__, __LINE__, __FUNCTION__)
+#else
#define compilerrt_abort() abort()
+#endif
#if !defined(INFINITY) && defined(HUGE_VAL)
#define INFINITY HUGE_VAL
diff --git a/make/lib_info.mk b/make/lib_info.mk
index a54152a4f..72bc4a17f 100644
--- a/make/lib_info.mk
+++ b/make/lib_info.mk
@@ -47,4 +47,5 @@ $(foreach key,$(SubDirKeys),\
AvailableOptions := AR ARFLAGS \
CC CFLAGS FUNCTIONS OPTIMIZED \
RANLIB RANLIBFLAGS \
- VISIBILITY_HIDDEN
+ VISIBILITY_HIDDEN \
+ KERNEL_USE
diff --git a/make/platform/clang_darwin.mk b/make/platform/clang_darwin.mk
index ffa0dabb4..d6856807b 100644
--- a/make/platform/clang_darwin.mk
+++ b/make/platform/clang_darwin.mk
@@ -242,4 +242,6 @@ FUNCTIONS.cc_kext.i386 := \
FUNCTIONS.cc_kext.x86_64 := \
$(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.x86_64))
+KERNEL_USE.cc_kext := 1
+
VISIBILITY_HIDDEN := 1