From 92addb538e02fb67f2e2399b2717d58412c2e308 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 13 Jan 2021 08:30:24 -0800 Subject: [PATCH] stratosphere: discard unnecessary .eh_frame segment --- config/templates/stratosphere.mk | 2 +- libstratosphere/discard-ehframe.ld | 7 +++++++ libstratosphere/stratosphere.specs | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 libstratosphere/discard-ehframe.ld create mode 100644 libstratosphere/stratosphere.specs diff --git a/config/templates/stratosphere.mk b/config/templates/stratosphere.mk index f8a86bb5..6f4395b1 100644 --- a/config/templates/stratosphere.mk +++ b/config/templates/stratosphere.mk @@ -36,7 +36,7 @@ export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \ -Wl,--wrap,_ZSt20__throw_length_errorPKc \ -Wl,--wrap,_ZNSt11logic_errorC2EPKc -export LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs $(SETTINGS) $(CXXWRAPS) -Wl,-Map,$(notdir $*.map) +export LDFLAGS = -specs=$(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/stratosphere.specs -specs=$(DEVKITPRO)/libnx/switch.specs $(SETTINGS) $(CXXWRAPS) -Wl,-Map,$(notdir $*.map) export LIBS = -lstratosphere -lnx diff --git a/libstratosphere/discard-ehframe.ld b/libstratosphere/discard-ehframe.ld new file mode 100644 index 00000000..b3b067e0 --- /dev/null +++ b/libstratosphere/discard-ehframe.ld @@ -0,0 +1,7 @@ +SECTIONS +{ + /* Discard .eh_frame section */ + /DISCARD/ : { *(.group .comment .note .interp) + EXCLUDE_FILE(*crtbegin.o) *(.eh_frame_hdr .eh_frame) + } +} diff --git a/libstratosphere/stratosphere.specs b/libstratosphere/stratosphere.specs new file mode 100644 index 00000000..d1ba47ae --- /dev/null +++ b/libstratosphere/stratosphere.specs @@ -0,0 +1,4 @@ +%rename link pre_old_link + +*link: +%(pre_old_link) -T %:getenv(ATMOSPHERE_LIBRARIES_DIR /libstratosphere/discard-ehframe.ld)