Skip to content

Commit

Permalink
Fix no-exception libstdc++
Browse files Browse the repository at this point in the history
Was including the exception enabled version by default.

Fixing this saves ~6K flash and 4K RAM.
  • Loading branch information
earlephilhower committed Jun 7, 2022
1 parent b0ae810 commit a871782
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
REL := $(if $(REL),$(REL),1.0.0)
SUBREL := $(if $(SUBREL),$(SUBREL),testing)
ARDUINO := $(if $(ARDUINO),$(ARDUINO),$(shell pwd)/arduino)
GCC := $(if $(GCC),$(GCC),10.2)
GCC := $(if $(GCC),$(GCC),10.3)

# General constants
PWD := $(shell pwd)
Expand Down Expand Up @@ -486,11 +486,11 @@ clean: .cleaninst.LINUX.clean .cleaninst.LINUX32.clean .cleaninst.WIN32.clean .c
.stage.%.libstdcpp-nox: .stage.%.libstdcpp
echo STAGE: $@
# We copy existing stdc, adjust the makefile, and build a single .a to save much time
cp $(ARCH)$(call ext,$@)/$(ARCH)/lib/thumb/libstdc++.a $(ARCH)$(call ext,$@)/$(ARCH)/lib/thumb/libstdc++-exc.a >> $(call log,$@) 2>&1
rm -rf $(call arena,$@)/$(GCC_DIR)/$(ARCH)/libstdc++-v3-nox > $(call log,$@) 2>&1
cp -a $(call arena,$@)/$(GCC_DIR)/$(ARCH)/libstdc++-v3 $(call arena,$@)/$(GCC_DIR)/$(ARCH)/libstdc++-v3-nox >> $(call log,$@) 2>&1
(cd $(call arena,$@)/$(GCC_DIR)/$(ARCH)/libstdc++-v3-nox; $(call setenv,$@); $(MAKE) clean; find . -name Makefile -exec sed -i 's/-free/-free -fno-exceptions/' \{\} \; ; $(MAKE)) >> $(call log,$@) 2>&1
cp $(ARCH)$(call ext,$@)/$(ARCH)/lib/thumb/libstdc++.a $(ARCH)$(call ext,$@)/$(ARCH)/lib/thumb/libstdc++-exc.a >> $(call log,$@) 2>&1
cp $(call arena,$@)/$(GCC_DIR)/$(ARCH)/libstdc++-v3-nox/src/.libs/libstdc++.a $(ARCH)$(call ext,$@)/$(ARCH)/lib/libstdc++.a >> $(call log,$@) 2>&1
cp $(call arena,$@)/$(GCC_DIR)/$(ARCH)/libstdc++-v3-nox/src/.libs/libstdc++.a $(ARCH)$(call ext,$@)/$(ARCH)/lib/thumb/libstdc++.a >> $(call log,$@) 2>&1
touch $@

.stage.%.strip: .stage.%.libstdcpp-nox
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Allows building Win32, Win64, OSX, Linux x86_64, ARM64 (aarch64) and Raspberry P

## Work In Progesss

Builds work for GCC 9.3, and 10.x. Others not fully tested but were building last time they were tried.
Builds work for GCC 9.3, 10.x, and 12.1. Others not fully tested but were building last time they were tried.

## Downloading GCC/etc. sources

Expand All @@ -18,7 +18,7 @@ to clone the GCC and libs needed to the repo/ directory. This takes a while, so

If you're only compiling natively, you can just clone this repo and run
````
make GCC={9.3|10.2|10.3} REL=x.x.x SUBREL=x -jx # I like -j32 on a 16-core server, adjust according to your CPU power
make GCC={9.3|10.2|10.3|12.1} REL=x.x.x SUBREL=x -jx # I like -j32 on a 16-core server, adjust according to your CPU power
````

Note that to build a non-linux toolchain, you first need to build a linux chain in the directory. This is because the cross compiler requires a local host executable gcc for the target architecture to build properly.
Expand All @@ -29,7 +29,7 @@ To build all architectures use the commands
````
git clone https://github.com/earlephilhower/pico-quick-toolchain
cd pico-quick-toolchain
docker run --user $(id -u):$(id -g) --rm -v $(pwd):/workdir earlephilhower/gcc-cross-v6 bash -c "cd /workdir; make -j32 GCC={9.3|10.1|10.2|10.3} REL=2.5.0 SUBREL=3 all"
docker run --user $(id -u):$(id -g) --rm -v $(pwd):/workdir earlephilhower/gcc-cross-v6 bash -c "cd /workdir; make -j32 GCC={9.3|10.1|10.2|10.3|12.1} REL=2.5.0 SUBREL=3 all"
````

To make a draft release of the binaries:
Expand All @@ -41,7 +41,7 @@ You then promote the draft to a pre-release so it becomes visible and can then m

Then to install the libraries and headers into the Arduino core (not including the toolchain exes) just
````
make GCC={9.3|10.2|10.3} REL=2.5.0 SUBREL=3 install (INSTALLBRANCH=xxx may be added to apply against a predefined branch other than master)
make GCC={9.3|10.2|10.3|12.1} REL=2.5.0 SUBREL=3 install (INSTALLBRANCH=xxx may be added to apply against a predefined branch other than master)
<in Arduino dir>
git commit -a
````

0 comments on commit a871782

Please sign in to comment.