Skip to content

Commit 7761867

Browse files
committed
Binutils 2.37
A patch is needed for the build to work with MinGW which doesn't define the compatibility `uint` type used by the Rust demangler in libiberty.
1 parent 878ba7a commit 7761867

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: CI
22
env:
3-
BINUTILS_VERSION: 2.36.1
3+
BINUTILS_VERSION: 2.37
44

55
on:
66
push:

build.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ TRUE_PATH=$(readlink "$0" || echo "$0")
44
MY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
55
BUILD_DIR="${MY_DIR}/build"
66
ARTIFACTS_DIR="${MY_DIR}/artifacts"
7+
PATCHES_DIR="${MY_DIR}/patches"
78
VERSION_INFO_FILE="${ARTIFACTS_DIR}/version.txt"
89
CACHE_DIR="${HOME}/android-archives"
910
OS=$(uname -s)
@@ -16,6 +17,7 @@ MACOS_TARGET="10.9"
1617

1718
VERSION="${1}"
1819
BINUTILS_DIR_NAME="binutils-${VERSION}"
20+
BINUTILS_PATCH_NAME="binutils-${VERSION}.diff"
1921

2022
function die()
2123
{
@@ -165,6 +167,12 @@ function build()
165167

166168
tar xf "${TARBALL_DEST}"
167169

170+
local source_dir="${BUILD_DIR}/${BINUTILS_DIR_NAME}"
171+
local binutils_patch="${PATCHES_DIR}/${BINUTILS_PATCH_NAME}"
172+
if [ -f "${binutils_patch}" ]; then
173+
(cd "${source_dir}"; patch -p1 < "${binutils_patch}")
174+
fi
175+
168176
local configure_host
169177

170178
case "${host}" in
@@ -179,7 +187,6 @@ function build()
179187
install -d -m 755 "${build_tree}"
180188

181189
local cflags="-O2 -m64 $(detect_mac_arch_flags)"
182-
local source_dir="${BUILD_DIR}/${BINUTILS_DIR_NAME}"
183190
local enable_gold
184191
local other_flags
185192

patches/binutils-2.37.diff

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff -U3 -Narp binutils-2.37.orig/libiberty/rust-demangle.c binutils-2.37/libiberty/rust-demangle.c
2+
--- binutils-2.37.orig/libiberty/rust-demangle.c 2021-07-15 16:19:46.000000000 +0200
3+
+++ binutils-2.37/libiberty/rust-demangle.c 2021-07-19 09:50:29.003790488 +0200
4+
@@ -75,10 +75,10 @@ struct rust_demangler
5+
int version;
6+
7+
/* Recursion depth. */
8+
- uint recursion;
9+
+ unsigned int recursion;
10+
/* Maximum number of times demangle_path may be called recursively. */
11+
#define RUST_MAX_RECURSION_COUNT 1024
12+
-#define RUST_NO_RECURSION_LIMIT ((uint) -1)
13+
+#define RUST_NO_RECURSION_LIMIT ((unsigned int) -1)
14+
15+
uint64_t bound_lifetime_depth;
16+
};

0 commit comments

Comments
 (0)