Created
October 30, 2019 00:52
-
-
Save dnadlinger/10f3106b44f8b5926c9e84c3af310839 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/misoc/software/include/base/stdbool.h b/misoc/software/include/base/stdbool.h | |
index d58bb58f..30b41651 100644 | |
--- a/misoc/software/include/base/stdbool.h | |
+++ b/misoc/software/include/base/stdbool.h | |
@@ -1,8 +1,12 @@ | |
#ifndef __STDBOOL_H | |
#define __STDBOOL_H | |
+#ifndef __cplusplus | |
+ | |
#define bool _Bool | |
#define true 1 | |
#define false 0 | |
+#endif | |
+ | |
#endif /* __STDBOOL_H */ | |
diff --git a/misoc/software/libunwind/Makefile b/misoc/software/libunwind/Makefile | |
index 863070d7..fcf77a04 | |
--- a/misoc/software/libunwind/Makefile | |
+++ b/misoc/software/libunwind/Makefile | |
@@ -6,15 +6,25 @@ COMMONFLAGS += -integrated-as -I. \ | |
-I$(MISOC_DIRECTORY)/software/unwinder/include/ \ | |
-I$(LIBUNWIND_DIRECTORY) \ | |
-D__ELF__ -D__linux__ \ | |
- -D_LIBUNWIND_NO_HEAP -D_LIBUNWIND_BUILD_ZERO_COST_APIS \ | |
+ -D_LIBUNWIND_NO_HEAP \ | |
-DNDEBUG | |
+# The libunwind code itself obviously doesn't require EH to work (so avoid | |
+# emitting cleanups that reference the personality funcion), but we need | |
+# to be able to start unwinding from _Unwind_RaiseException et al. | |
+CXXFLAGS += -fno-exceptions -funwind-tables | |
+ | |
ifeq ($(CPU),or1k) | |
all:: libunwind-bare.a libunwind-elf.a | |
endif | |
+ifeq ($(CPU),cortex-a9) | |
+all:: libunwind-bare.a libunwind-elf.a | |
+endif | |
+ | |
libunwind-%.a: UnwindRegistersSave.o UnwindRegistersRestore.o \ | |
- UnwindLevel1-%.o UnwindLevel1-gcc-ext-%.o libunwind-%.o | |
+ UnwindLevel1-%.o UnwindLevel1-gcc-ext-%.o libunwind-%.o \ | |
+ Unwind-EHABI-%.o | |
$(archive) | |
%.o: $(MISOC_DIRECTORY)/software/unwinder/src/%.S | |
diff --git a/misoc/software/libunwind/__cxxabi_config.h b/misoc/software/libunwind/__cxxabi_config.h | |
index 42cd6fe5..0f4511e2 100644 | |
--- a/misoc/software/libunwind/__cxxabi_config.h | |
+++ b/misoc/software/libunwind/__cxxabi_config.h | |
@@ -1 +1 @@ | |
-#define LIBCXXABI_ARM_EHABI 0 | |
+#define LIBCXXABI_ARM_EHABI 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 6968265a2cd5ddc5bca7600e71c0caa108ea8a6b (cjbe/master, master) | |
Author: David Nadlinger <code@klickverbot.at> | |
Date: Sat Jul 28 01:22:21 2018 +0100 | |
include/basec++: Implement enough of algorithm to compile ARM EHABI unwinder | |
diff --git a/misoc/software/include/basec++/algorithm b/misoc/software/include/basec++/algorithm | |
index cb9b6142..f34874c9 100644 | |
--- a/misoc/software/include/basec++/algorithm | |
+++ b/misoc/software/include/basec++/algorithm | |
@@ -1,4 +1,34 @@ | |
#ifndef __CXX_ALGORITHM | |
#define __CXX_ALGORITHM | |
+namespace std { | |
+ struct random_access_iterator_tag {}; | |
+ | |
+ template<class ForwardIt, class T> | |
+ ForwardIt upper_bound(ForwardIt first, ForwardIt last, const T& value) { | |
+ auto count = last - first; | |
+ | |
+ while (count > 0) { | |
+ auto it = first; | |
+ const auto step = count / 2; | |
+ it += step; | |
+ if (!(value < *it)) { | |
+ first = ++it; | |
+ count -= step + 1; | |
+ } else { | |
+ count = step; | |
+ } | |
+ } | |
+ return first; | |
+ } | |
+ | |
+ template<class T> class numeric_limits; | |
+ template<> | |
+ class numeric_limits<uintptr_t> { | |
+ public: | |
+ typedef uintptr_t type; | |
+ inline static constexpr type max() noexcept { return __UINTPTR_MAX__; } | |
+ }; | |
+} | |
+ | |
#endif /* __CXX_ALGORITHM */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment