From 587325cccf644fce1ccc05e26739d931f12c175c Mon Sep 17 00:00:00 2001 From: Lightos1 <124387232+Lightos1@users.noreply.github.com> Date: Wed, 15 Jul 2026 19:30:23 +0200 Subject: [PATCH] overlay: remove unwinding stacks to save ram --- Source/hoc-clk/overlay/Makefile | 4 ++-- Source/hoc-clk/overlay/src/main.cpp | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Source/hoc-clk/overlay/Makefile b/Source/hoc-clk/overlay/Makefile index e090282a..979948aa 100644 --- a/Source/hoc-clk/overlay/Makefile +++ b/Source/hoc-clk/overlay/Makefile @@ -49,7 +49,7 @@ DEFINES := -DDISABLE_IPC -DTARGET="\"$(TARGET)\"" -DTARGET_VERSION="\"$(TARGET_V ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE -CFLAGS := -Os -Wall -flto -fdata-sections -ffunction-sections -fno-rtti -fno-common \ +CFLAGS := -Os -Wall -flto -fdata-sections -ffunction-sections -fno-rtti -fno-common -fno-asynchronous-unwind-tables -fno-unwind-tables \ $(ARCH) $(DEFINES) CFLAGS += $(INCLUDE) -D__SWITCH__ @@ -67,7 +67,7 @@ CFLAGS += -DUI_OVERRIDE_PATH="\"$(UI_OVERRIDE_PATH)\"" CXXFLAGS := $(CFLAGS) -fno-exceptions -std=gnu++23 ASFLAGS := -g $(ARCH) -LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) +LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map),-wrap,__cxa_throw -Wl,-wrap,_Unwind_Resume -Wl,-wrap,__gxx_personality_v0 LIBS := -lcurl -lz -lminizip -lmbedtls -lmbedx509 -lmbedcrypto -ljansson -lnx diff --git a/Source/hoc-clk/overlay/src/main.cpp b/Source/hoc-clk/overlay/src/main.cpp index 80b311bd..41c411c5 100644 --- a/Source/hoc-clk/overlay/src/main.cpp +++ b/Source/hoc-clk/overlay/src/main.cpp @@ -30,6 +30,26 @@ #include "ui/gui/fatal_gui.h" #include "ui/gui/main_gui.h" +extern "C" { + // Ty to MasaGratoR for this! + // This is done to save some space as they have no practical use in our case + void *__real___cxa_throw(void *thrown_exception, void *pvar, void (*dest)(void *)); + void *__real__Unwind_Resume(); + void *__real___gxx_personality_v0(); + + void __wrap___cxa_throw(void *thrown_exception, void *pvar, void (*dest)(void *)) { + abort(); + } + + void __wrap__Unwind_Resume() { + return; + } + + void __wrap___gxx_personality_v0() { + return; + } +} + class AppOverlay : public tsl::Overlay { public: AppOverlay() {