Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
libtransistor.mk: enable section garbage collection and don't include…
Browse files Browse the repository at this point in the history
… whole libtransistor archive for substantial binary size reduction
  • Loading branch information
misson20000 committed Aug 22, 2018
1 parent a5f0cb7 commit 5aed454
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libtransistor.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ RUBY := ruby
SYS_INCLUDES := -isystem $(LIBTRANSISTOR_HOME)/include/
CPP_INCLUDES := -isystem $(LIBTRANSISTOR_HOME)/include/c++/v1/

PKG_CONFIG_SYSROOT_DIR=$(LIBTRANSISTOR_HOME)

# linker flags for building main binary
# -Bsymbolic: bind symbols locally
# --shared: build a shared object
LD_FLAGS := -Bsymbolic \
--shared \
--no-gc-sections \
--gc-sections \
--eh-frame-hdr \
--no-undefined \
-T $(LIBTRANSISTOR_HOME)/link.T \
Expand All @@ -48,7 +50,7 @@ LD_FLAGS := -Bsymbolic \
# --shared: build a shared object
# -Bdynamic: link against shared libraries
LD_SHARED_LIBRARY_FLAGS := --shared \
--no-gc-sections \
--gc-sections \
--eh-frame-hdr \
-T $(LIBTRANSISTOR_HOME)/link.T \
-L $(LIBTRANSISTOR_HOME)/lib/ \
Expand Down Expand Up @@ -89,8 +91,8 @@ LIBTRANSISTOR_EXECUTABLE_LDFLAGS := -Bstatic \
-lc -lm -lclang_rt.builtins-aarch64 -lpthread -llzma -lc++ -lc++abi -lunwind \
-Bdynamic

LIBTRANSISTOR_NRO_LDFLAGS := --whole-archive -ltransistor.nro --no-whole-archive $(LIBTRANSISTOR_EXECUTABLE_LDFLAGS)
LIBTRANSISTOR_NSO_LDFLAGS := --whole-archive -ltransistor.nso --no-whole-archive $(LIBTRANSISTOR_EXECUTABLE_LDFLAGS)
LIBTRANSISTOR_NRO_LDFLAGS := -ltransistor.nro $(LIBTRANSISTOR_EXECUTABLE_LDFLAGS)
LIBTRANSISTOR_NSO_LDFLAGS := -ltransistor.nso $(LIBTRANSISTOR_EXECUTABLE_LDFLAGS)
LIBTRANSISTOR_LIB_LDFLAGS := -lc -lclang_rt.builtins-aarch64 -lc++ -lc++abi -lunwind

ifneq ($(NRO_ICON),)
Expand Down

0 comments on commit 5aed454

Please sign in to comment.