summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-11-13 23:55:06 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-11-13 23:55:06 +0000
commit6122d0692bf261ce4df586c7bb5625e1ede9da98 (patch)
treef4e285a7d15e102de3dc09fac1f3063c06655f58 /compiler-rt/lib
parent05dce7e644cf2043eb0076e4b7c9273ec188dddc (diff)
downloadbcm5719-llvm-6122d0692bf261ce4df586c7bb5625e1ede9da98.tar.gz
bcm5719-llvm-6122d0692bf261ce4df586c7bb5625e1ede9da98.zip
Support for building the ubsan runtime when using the autoconf build system on
Darwin. Patch by Jean-Daniel Dupas, tweaked by Jonathan Sauer, simplified somewhat by me. llvm-svn: 167889
Diffstat (limited to 'compiler-rt/lib')
-rw-r--r--compiler-rt/lib/Makefile.mk1
-rw-r--r--compiler-rt/lib/ubsan/Makefile.mk23
-rw-r--r--compiler-rt/lib/ubsan/ubsan_value.h6
3 files changed, 27 insertions, 3 deletions
diff --git a/compiler-rt/lib/Makefile.mk b/compiler-rt/lib/Makefile.mk
index 791921a8006..ea471e01b1e 100644
--- a/compiler-rt/lib/Makefile.mk
+++ b/compiler-rt/lib/Makefile.mk
@@ -19,6 +19,7 @@ SubDirs += interception
SubDirs += profile
SubDirs += sanitizer_common
SubDirs += tsan
+SubDirs += ubsan
# FIXME: We don't currently support building an atomic library, and as it must
# be a separate library from the runtime library, we need to remove its source
diff --git a/compiler-rt/lib/ubsan/Makefile.mk b/compiler-rt/lib/ubsan/Makefile.mk
new file mode 100644
index 00000000000..5702e0e752d
--- /dev/null
+++ b/compiler-rt/lib/ubsan/Makefile.mk
@@ -0,0 +1,23 @@
+#===- lib/ubsan/Makefile.mk ---------------------------------*- Makefile -*--===#
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===------------------------------------------------------------------------===#
+
+ModuleName := ubsan
+SubDirs :=
+
+Sources := $(foreach file,$(wildcard $(Dir)/*.cc),$(notdir $(file)))
+ObjNames := $(Sources:%.cc=%.o)
+
+Implementation := Generic
+
+# FIXME: use automatic dependencies?
+Dependencies := $(wildcard $(Dir)/*.h)
+Dependencies += $(wildcard $(Dir)/../sanitizer_common/*.h)
+
+# Define a convenience variable for all the ubsan functions.
+UbsanFunctions := $(Sources:%.cc=%)
diff --git a/compiler-rt/lib/ubsan/ubsan_value.h b/compiler-rt/lib/ubsan/ubsan_value.h
index a85579106ea..0c755ca9781 100644
--- a/compiler-rt/lib/ubsan/ubsan_value.h
+++ b/compiler-rt/lib/ubsan/ubsan_value.h
@@ -14,9 +14,9 @@
#ifndef UBSAN_VALUE_H
#define UBSAN_VALUE_H
-// For now, only support linux. Other platforms should be easy to add, and
-// probably work as-is.
-#if !defined(__linux__)
+// For now, only support linux and darwin. Other platforms should be easy to
+// add, and probably work as-is.
+#if !defined(__linux__) && !defined(__APPLE__)
#error "UBSan not supported for this platform!"
#endif
OpenPOWER on IntegriCloud