summaryrefslogtreecommitdiffstats
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
commit587b1d419d0557bb7c1c452dfc9f6143c41cf9fe (patch)
treef15a99425b0c803be2222fb5019de55b69392575
parentf28700879116ee0343bfd05317d46756142de6b4 (diff)
downloadbcm5719-llvm-587b1d419d0557bb7c1c452dfc9f6143c41cf9fe.tar.gz
bcm5719-llvm-587b1d419d0557bb7c1c452dfc9f6143c41cf9fe.zip
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.
llvm-svn: 100015
-rw-r--r--compiler-rt/Makefile8
-rw-r--r--compiler-rt/lib/int_lib.h7
-rw-r--r--compiler-rt/make/lib_info.mk3
-rw-r--r--compiler-rt/make/platform/clang_darwin.mk2
4 files changed, 18 insertions, 2 deletions
diff --git a/compiler-rt/Makefile b/compiler-rt/Makefile
index 95c02a666e5..530590618c6 100644
--- a/compiler-rt/Makefile
+++ b/compiler-rt/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/compiler-rt/lib/int_lib.h b/compiler-rt/lib/int_lib.h
index f6c2dd45ed8..912a12f5937 100644
--- a/compiler-rt/lib/int_lib.h
+++ b/compiler-rt/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/compiler-rt/make/lib_info.mk b/compiler-rt/make/lib_info.mk
index a54152a4feb..72bc4a17f15 100644
--- a/compiler-rt/make/lib_info.mk
+++ b/compiler-rt/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/compiler-rt/make/platform/clang_darwin.mk b/compiler-rt/make/platform/clang_darwin.mk
index ffa0dabb402..d6856807b34 100644
--- a/compiler-rt/make/platform/clang_darwin.mk
+++ b/compiler-rt/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
OpenPOWER on IntegriCloud