diff --git a/.github/workflows/1.0.0.yml b/.github/workflows/1.0.0.yml new file mode 100644 index 0000000..a17e5d5 --- /dev/null +++ b/.github/workflows/1.0.0.yml @@ -0,0 +1,11 @@ +name: 🚀 Deploy 1.0.0 + +on: + workflow_dispatch: + +jobs: + deploy: + uses: libhal/ci/.github/workflows/deploy_all.yml@5.x.y + with: + version: 1.0.0 + secrets: inherit diff --git a/conanfile.py b/conanfile.py index 4d3761c..4408c89 100644 --- a/conanfile.py +++ b/conanfile.py @@ -108,8 +108,9 @@ def package(self): cmake.install() def package_info(self): - self.cpp_info.libs = ["libhal-exceptions"] self.cpp_info.set_property("cmake_target_name", "libhal::exceptions") + lib_path = os.path.join(self.package_folder, + 'lib', 'liblibhal-exceptions.a') # Keep this for now, will update this for the runtime select if self._is_arm_cortex: @@ -117,4 +118,8 @@ def package_info(self): "-Wl,--wrap=__cxa_allocate_exception", "-Wl,--wrap=__cxa_free_exception", "-Wl,--wrap=__cxa_call_unexpected", + # Ensure that all symbols are added to the linker's symbol table + "-Wl,--whole-archive", + lib_path, + "-Wl,--no-whole-archive", ] diff --git a/include/libhal-exceptions/control.hpp b/include/libhal-exceptions/control.hpp index 9b65505..520517d 100644 --- a/include/libhal-exceptions/control.hpp +++ b/include/libhal-exceptions/control.hpp @@ -116,4 +116,4 @@ class single_thread_exception_allocator : public exception_allocator std::array m_buffer{}; bool m_allocated = false; }; -} // namespace hal \ No newline at end of file +} // namespace hal diff --git a/src/builtin/gcc/impl.cpp b/src/builtin/gcc/impl.cpp index c3b0593..5defa56 100644 --- a/src/builtin/gcc/impl.cpp +++ b/src/builtin/gcc/impl.cpp @@ -30,7 +30,7 @@ extern "C" std::terminate(); } - void* __wrap___cxa_allocate_exception(unsigned int p_size) // NOLINT + void* __wrap___cxa_allocate_exception(unsigned int p_size) noexcept // NOLINT { // Size of the GCC exception object header is 128 bytes. Will have to update // this if the size of the EO increases. 😅 diff --git a/src/control.cpp b/src/control.cpp index ac101af..4dda552 100644 --- a/src/control.cpp +++ b/src/control.cpp @@ -20,28 +20,6 @@ namespace __cxxabiv1 { // NOLINT std::terminate_handler __terminate_handler = +[]() { // NOLINT - // So you may be wondering what this code is doing here? Its actually a - // bit of weird circular logic. So the linker will garbage collect any - // functions that are not used in your code. If you somehow have an - // application without any exceptions thrown, the exception code will be - // eliminated. This would be great, but due the fact that our build system - // adds the `-Wl,--wrap=symbol` to the compiler to swap the function - // implementations, this results in the compiler yelling at the user that - // they are missing a wrapped function. In order to prevent the compiler - // from throwing away this function and then turning around demanding that - // we supply it, we simply need to call throw somewhere in the code. That - // will force it to link in the original implementations which will be - // swapped out with our wrapped implementations. - // - // Use a volatile bool that is always set to false to ensure that the - // "throw 5" is NEVER called. - // - // This location was choosen because it always links in for GCC. - volatile bool force_exceptions_to_link = false; - if (force_exceptions_to_link) { - throw 5; - } - while (true) { continue; } @@ -63,11 +41,9 @@ std::terminate_handler get_terminate() noexcept } // TODO(#11): Add macro to IFDEF this out if the user want to save 256 bytes. -using default_single_thread_exception_allocator = - single_thread_exception_allocator<256>; - -default_single_thread_exception_allocator default_allocator{}; -exception_allocator* __exception_allocator = &default_allocator; // NOLINT +using default_exception_allocator = single_thread_exception_allocator<256>; +default_exception_allocator __default_allocator{}; // NOLINT +exception_allocator* __exception_allocator = &__default_allocator; // NOLINT void set_exception_allocator(exception_allocator& p_allocator) noexcept { @@ -78,4 +54,4 @@ exception_allocator* get_exception_allocator() noexcept { return __exception_allocator; } -} // namespace hal \ No newline at end of file +} // namespace hal