Skip to content

Commit

Permalink
Binutils 2.37
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
grendello committed Jul 19, 2021
1 parent 878ba7a commit 7761867
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI
env:
BINUTILS_VERSION: 2.36.1
BINUTILS_VERSION: 2.37

on:
push:
Expand Down
9 changes: 8 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TRUE_PATH=$(readlink "$0" || echo "$0")
MY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
BUILD_DIR="${MY_DIR}/build"
ARTIFACTS_DIR="${MY_DIR}/artifacts"
PATCHES_DIR="${MY_DIR}/patches"
VERSION_INFO_FILE="${ARTIFACTS_DIR}/version.txt"
CACHE_DIR="${HOME}/android-archives"
OS=$(uname -s)
Expand All @@ -16,6 +17,7 @@ MACOS_TARGET="10.9"

VERSION="${1}"
BINUTILS_DIR_NAME="binutils-${VERSION}"
BINUTILS_PATCH_NAME="binutils-${VERSION}.diff"

function die()
{
Expand Down Expand Up @@ -165,6 +167,12 @@ function build()

tar xf "${TARBALL_DEST}"

local source_dir="${BUILD_DIR}/${BINUTILS_DIR_NAME}"
local binutils_patch="${PATCHES_DIR}/${BINUTILS_PATCH_NAME}"
if [ -f "${binutils_patch}" ]; then
(cd "${source_dir}"; patch -p1 < "${binutils_patch}")
fi

local configure_host

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

local cflags="-O2 -m64 $(detect_mac_arch_flags)"
local source_dir="${BUILD_DIR}/${BINUTILS_DIR_NAME}"
local enable_gold
local other_flags

Expand Down
16 changes: 16 additions & 0 deletions patches/binutils-2.37.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff -U3 -Narp binutils-2.37.orig/libiberty/rust-demangle.c binutils-2.37/libiberty/rust-demangle.c
--- binutils-2.37.orig/libiberty/rust-demangle.c 2021-07-15 16:19:46.000000000 +0200
+++ binutils-2.37/libiberty/rust-demangle.c 2021-07-19 09:50:29.003790488 +0200
@@ -75,10 +75,10 @@ struct rust_demangler
int version;

/* Recursion depth. */
- uint recursion;
+ unsigned int recursion;
/* Maximum number of times demangle_path may be called recursively. */
#define RUST_MAX_RECURSION_COUNT 1024
-#define RUST_NO_RECURSION_LIMIT ((uint) -1)
+#define RUST_NO_RECURSION_LIMIT ((unsigned int) -1)

uint64_t bound_lifetime_depth;
};

0 comments on commit 7761867

Please sign in to comment.