Skip to content

Commit 1b91a91

Browse files
FIxining and improving the script
1 parent 8e939f4 commit 1b91a91

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tools/build_newlib.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ apt install -y --no-install-recommends texinfo
4646
# Get the latest fixed version
4747
git clone --depth=1 --single-branch --branch newlib-4.5.0 https://sourceware.org/git/newlib-cygwin.git "${SRC}"
4848

49+
# Apply patch to fix "undefined symbol: __aeabi_unwind_cpp_pr0 referenced by libc_a-setjmp.o" issue
50+
PATCH_NAME="cantunwind.patch"
51+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
52+
cp "${SCRIPT_DIR}/${PATCH_NAME}" "${SRC}"
53+
cd "${SRC}"
54+
git apply "${PATCH_NAME}"
55+
cd ..
4956

5057
# Build configuration
5158
mkdir -p "${BUILD}" "${INSTALL}"
@@ -79,6 +86,9 @@ CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections -fshort-wchar -DPREFER_SI
7986
make "-j$(nproc)"
8087
make install
8188

89+
# Stripping debug symbols
90+
arm-none-eabi-strip --strip-debug "${INSTALL}/arm-none-eabi/lib/libc.a"
91+
arm-none-eabi-strip --strip-debug "${INSTALL}/arm-none-eabi/lib/libm.a"
8292

8393
# Copy back
8494
mkdir -p "$OUTPUT_DIR"

0 commit comments

Comments
 (0)