[PATCH] D30340: [libunwind] Disable calls to fprintf when building for baremetal targets in release mode
Ranjeet Singh via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 24 08:11:25 PST 2017
rs created this revision.
We've been having issues with using libcxxabi and libunwind for baremetal targets because fprintf is dependent on io functions, this patch disable calls to fprintf when building for baremetal targets in release mode.
https://reviews.llvm.org/D30340
Files:
src/config.h
Index: src/config.h
===================================================================
--- src/config.h
+++ src/config.h
@@ -78,16 +78,27 @@
#define _LIBUNWIND_BUILD_ZERO_COST_APIS 0
#endif
+#if defined(NDEBUG) && defined(_LIBUNWIND_IS_BAREMETAL)
+#define _LIBUNWIND_ABORT(msg) \
+ do { \
+ abort(); \
+ } while (0)
+#else
#define _LIBUNWIND_ABORT(msg) \
do { \
fprintf(stderr, "libunwind: %s %s:%d - %s\n", __func__, __FILE__, \
__LINE__, msg); \
fflush(stderr); \
abort(); \
} while (0)
+#endif
+#if defined(NDEBUG) && defined(_LIBUNWIND_IS_BAREMETAL)
+#define _LIBUNWIND_LOG(msg, ...)
+#else
#define _LIBUNWIND_LOG(msg, ...) \
fprintf(stderr, "libunwind: " msg "\n", __VA_ARGS__)
+#endif
#if defined(_LIBUNWIND_HAS_NO_THREADS)
// only used with pthread calls, not needed for the single-threaded builds
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30340.89676.patch
Type: text/x-patch
Size: 1401 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170224/6a7139bf/attachment.bin>
More information about the cfe-commits
mailing list