Fix build for binutils 2.45.1 with GAS support

- Fix BFD target struct for 2.45.1 API (remove TARGET_MERGE_SECTIONS)
- Fix ppc-dis.c variable names for 2.45.1 (dialect/sticky locals)
- Guard OBJ_XCOFF in tc-ppc.h to exclude TE_PE targets
- Fix md_apply_fix XCOFF-only code path for PE/COFF builds
- Remove broken LD aixppc emulation entry (XCOFF-only)
- Match gc-wii-binutils host build pattern (no patches needed)
- Use ftpmirror.gnu.org for reliable downloads
This commit is contained in:
Luke Street
2026-02-08 19:45:45 -07:00
parent 6af42f9bf7
commit 8343998207
4 changed files with 161 additions and 501 deletions
File diff suppressed because it is too large Load Diff
+6 -8
View File
@@ -3,7 +3,7 @@ ARG ALPINE_VERSION=3.19.1
FROM alpine:${ALPINE_VERSION} AS build
# Install dependencies
RUN apk add --no-cache binutils file gcc make musl-dev patch
RUN apk add --no-cache binutils file gcc make musl-dev patch texinfo
# Install zig
ARG ZIG_VERSION=0.11.0
@@ -14,29 +14,27 @@ ENV PATH="/zig:$PATH"
# Download binutils
ARG BINUTILS_VERSION=2.45.1
RUN wget -q https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.xz
# Copy patches (needed for both host and target builds)
COPY *.patch /
RUN wget -q https://ftpmirror.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.xz
# Build host binutils
ARG GNU_TRIPLE
RUN mkdir /binutils-host && \
tar -xf /binutils-${BINUTILS_VERSION}.tar.xz -C /binutils-host --strip-components=1 && \
cd /binutils-host && for patch in ../*.patch; do patch -N -p1 -i $patch; done && \
./configure --target=powerpc-xenon-pe --prefix=/usr/local \
cd /binutils-host && \
./configure --target=${GNU_TRIPLE} --prefix=/usr/local \
--disable-nls --disable-shared --disable-gprofng --disable-ld --disable-gold && \
make -j$(nproc) && \
make install-strip
# Build target binutils
ARG ZIG_TRIPLE
COPY *.patch /
RUN mkdir /binutils && \
tar -xf /binutils-${BINUTILS_VERSION}.tar.xz -C /binutils --strip-components=1 && \
cd /binutils && for patch in ../*.patch; do patch -N -p1 -i $patch; done && \
CC="zig cc -target ${ZIG_TRIPLE}" \
./configure --host=${GNU_TRIPLE} --target=powerpc-xenon-pe --prefix=/target \
--disable-nls --disable-shared --disable-gprof --without-zstd && \
--disable-nls --disable-shared --disable-gprof --disable-ld --disable-gold --without-zstd && \
make -j$(nproc) && \
make install-strip
+2 -2
View File
@@ -1,13 +1,13 @@
#!/bin/bash -ex
PREFIX="$(pwd)/build"
mkdir source
wget -qO- https://ftp.gnu.org/gnu/binutils/binutils-2.45.1.tar.xz | tar -xJ -C source --strip-components=1
wget -qO- https://ftpmirror.gnu.org/gnu/binutils/binutils-2.45.1.tar.xz | tar -xJ -C source --strip-components=1
cd source
for patch in ../*.patch; do
patch -N -p1 -i "$patch"
done
export CFLAGS="-arch arm64 -arch x86_64 -mmacosx-version-min=10.11"
./configure --target=powerpc-xenon-pe --prefix="$PREFIX" --disable-nls --disable-shared --disable-gprof --without-zstd
./configure --target=powerpc-xenon-pe --prefix="$PREFIX" --disable-nls --disable-shared --disable-gprof --disable-ld --disable-gold --without-zstd
make -j$(nproc) configure-host
make -j$(nproc)
make install-strip
+2 -2
View File
@@ -1,12 +1,12 @@
#!/bin/bash -ex
PREFIX="$(pwd)/build"
mkdir source
wget -qO- https://ftp.gnu.org/gnu/binutils/binutils-2.45.1.tar.xz | tar -xJ -C source --strip-components=1
wget -qO- https://ftpmirror.gnu.org/gnu/binutils/binutils-2.45.1.tar.xz | tar -xJ -C source --strip-components=1
cd source
for patch in ../*.patch; do
patch -N -p1 -i "$patch"
done
./configure --target=powerpc-xenon-pe --prefix="$PREFIX" --disable-nls --disable-shared --disable-gprof --without-zstd
./configure --target=powerpc-xenon-pe --prefix="$PREFIX" --disable-nls --disable-shared --disable-gprof --disable-ld --disable-gold --without-zstd
make -j$(nproc) configure-host
make -j$(nproc)
make install-strip