Skip to content

Commit 3343a8e

Browse files
[z80] add build scripts and improvements for toolchain
[ci] add build script Fix CI [ci] upload nightly release [ci] disable shared libraries for windows [ci] disable zstd [ci] remove duplicate binaries [ci] include license files [ci] disable plugins [ci] exclude lib folder gdb: z80: guard saved_reg addr access The z80 unwinder calls trad_frame_saved_reg::addr() on entries that are still REALREG, which trips an assertion in debug builds. Guard the addr() access with is_addr() so only actual saved-address regs are adjusted. This keeps debug and release behavior consistent. gas: z80: enable CFI support gdb: dwarf: hack in 24-bit address support ci: build GDB too
1 parent 49d4d3f commit 3343a8e

5 files changed

Lines changed: 207 additions & 1 deletion

File tree

.github/workflows/make.yml

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
name: Win/Mac/Linux
2+
3+
on:2_45_1
4+
push:
5+
branches:
6+
- binutils-2_46-cedev
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
runs-on: [ubuntu-22.04, macos-15-intel, macos-14, windows-latest]
15+
include:
16+
- runs-on: ubuntu-22.04
17+
install-output-ext: "tar.gz"
18+
- runs-on: macos-15-intel
19+
arch-suffix: "-intel"
20+
install-output-ext: "tar.gz"
21+
- runs-on: macos-14
22+
arch-suffix: "-arm"
23+
install-output-ext: "tar.gz"
24+
- runs-on: windows-latest
25+
install-output-ext: "tar.gz"
26+
runs-on: ${{ matrix.runs-on }}
27+
steps:
28+
- name: Checkout binutils
29+
uses: actions/checkout@v4
30+
with:
31+
submodules: recursive
32+
33+
- name: "[Linux] Install dependencies"
34+
if: runner.os == 'Linux'
35+
run: sudo apt-get update && sudo apt-get install -y texinfo libreadline-dev libgmp-dev libmpfr-dev
36+
37+
- name: "[macOS] Install dependencies"
38+
if: runner.os == 'macOS'
39+
run: brew install texinfo gmp mpfr
40+
41+
- name: Setup MSYS2
42+
if: runner.os == 'Windows'
43+
uses: msys2/setup-msys2@v2
44+
with:
45+
msystem: MINGW64
46+
update: false
47+
cache: true
48+
install: >-
49+
mingw-w64-x86_64-toolchain
50+
mingw-w64-x86_64-autotools
51+
mingw-w64-x86_64-gettext-tools
52+
make
53+
texinfo
54+
bison
55+
flex
56+
gmp
57+
mpfr
58+
59+
- name: "[Linux] Build binutils"
60+
if: runner.os == 'Linux'
61+
shell: bash
62+
run: |
63+
./configure --target=z80-none-elf --with-zstd=no --disable-sim --disable-nls --disable-plugins --without-python --prefix="${{ runner.temp }}/binutils"
64+
make -j4 && make install-strip -j4
65+
66+
- name: "[macOS] Build binutils"
67+
if: runner.os == 'macOS'
68+
shell: bash
69+
run: |
70+
./configure --target=z80-none-elf --with-zstd=no --disable-sim --disable-nls --disable-plugins --without-python --with-system-zlib --with-gmp=$(brew --prefix gmp) --with-mpfr=$(brew --prefix mpfr) --prefix="${{ runner.temp }}/binutils"
71+
make -j4 && make install-strip -j4
72+
73+
- name: "[Windows] Build binutils"
74+
if: runner.os == 'Windows'
75+
shell: msys2 {0}
76+
run: |
77+
export ac_cv_header_term_h=no
78+
export ac_cv_header_ncurses_term_h=no
79+
export ac_cv_search_tgetent=no
80+
PREFIX=$(cygpath -m "${{ runner.temp }}/binutils")
81+
./configure --target=z80-none-elf --disable-tui --without-curses --with-zstd=no --disable-sim --disable-nls --disable-plugins --disable-shared --enable-static --without-python --prefix="$PREFIX"
82+
make configure-host && make -j4 LDFLAGS="-all-static" MAKEINFO=true && make install-strip -j4 MAKEINFO=true
83+
84+
- name: "[Unix] Install License Files"
85+
if: runner.os != 'Windows'
86+
shell: bash
87+
run: |
88+
mkdir -p "${{ runner.temp }}/binutils/license"
89+
cp COPYING3 "${{ runner.temp }}/binutils/license"
90+
cp COPYING3.LIB "${{ runner.temp }}/binutils/license"
91+
cp readme.txt "${{ runner.temp }}/binutils"
92+
- name: "[Windows] Install License Files"
93+
if: runner.os == 'Windows'
94+
shell: pwsh
95+
run: |
96+
New-Item -ItemType Directory -Force -Path "${{ runner.temp }}\binutils\license"
97+
Copy-Item COPYING3 -Destination "${{ runner.temp }}\binutils\license"
98+
Copy-Item COPYING3.LIB -Destination "${{ runner.temp }}\binutils\license"
99+
Copy-Item readme.txt -Destination "${{ runner.temp }}\binutils"
100+
101+
- name: "[Unix] Tar install"
102+
if: runner.os != 'Windows'
103+
shell: bash
104+
run: |
105+
cd ${{ runner.temp }} && tar -chzvf binutils-${{ runner.os }}.${{ matrix.install-output-ext }} --exclude='z80-none-elf' --exclude='lib' binutils
106+
mv ${{ runner.temp }}/binutils-${{ runner.os }}.${{ matrix.install-output-ext }} ${{github.workspace}}
107+
108+
- name: "[Windows] Tar install"
109+
if: runner.os == 'Windows'
110+
shell: pwsh
111+
run: |
112+
Set-Location "${{ runner.temp }}"
113+
tar -chzvf "binutils-${{ runner.os }}.${{ matrix.install-output-ext }}" --exclude='z80-none-elf' --exclude='lib' binutils
114+
Move-Item "binutils-${{ runner.os }}.${{ matrix.install-output-ext }}" "${{ github.workspace }}"
115+
116+
- name: Upload binutils
117+
uses: actions/upload-artifact@v4
118+
with:
119+
name: binutils-${{ runner.os }}${{ matrix.arch-suffix }}
120+
path: binutils-${{ runner.os }}.${{ matrix.install-output-ext }}
121+
122+
123+
nightly:
124+
runs-on: ubuntu-latest
125+
needs: [build]
126+
if: github.event_name != 'pull_request'
127+
128+
steps:
129+
- name: Download Ubuntu binutils
130+
uses: actions/download-artifact@v4
131+
with:
132+
name: binutils-Linux
133+
path: ${{github.workspace}}/ubuntu
134+
135+
- name: Download macOS Intel binutils
136+
uses: actions/download-artifact@v4
137+
with:
138+
name: binutils-macOS-intel
139+
path: ${{github.workspace}}/macos-intel
140+
141+
- name: Download macOS ARM binutils
142+
uses: actions/download-artifact@v4
143+
with:
144+
name: binutils-macOS-arm
145+
path: ${{github.workspace}}/macos-arm
146+
147+
- name: Download Windows binutils
148+
uses: actions/download-artifact@v4
149+
with:
150+
name: binutils-Windows
151+
path: ${{github.workspace}}/windows
152+
153+
- name: Create Ubunutu Nightly
154+
run: |
155+
cd ubuntu
156+
mv binutils-Linux.tar.gz ../binutils_ubuntu_nightly.tar.gz
157+
158+
- name: Create macOS Intel Nightly
159+
run: |
160+
cd macos-intel
161+
mv binutils-macOS.tar.gz ../binutils_macos_intel_nightly.tar.gz
162+
163+
- name: Create macOS ARM Nightly
164+
run: |
165+
cd macos-arm
166+
mv binutils-macOS.tar.gz ../binutils_macos_arm_nightly.tar.gz
167+
168+
- name: Create Windows Nightly
169+
run: |
170+
cd windows
171+
tar -xzvf binutils-Windows.tar.gz
172+
zip -r9 ../binutils_windows_nightly.zip binutils
173+
174+
- name: Create Nightly Release
175+
uses: softprops/action-gh-release@5122b4edc95f85501a71628a57dc180a03ec7588
176+
with:
177+
tag_name: nightly
178+
name: Nightly Build
179+
prerelease: true
180+
files: |
181+
binutils_ubuntu_nightly.tar.gz
182+
binutils_macos_intel_nightly.tar.gz
183+
binutils_macos_arm_nightly.tar.gz
184+
binutils_windows_nightly.zip

gas/config/tc-z80.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ extern void z80_elf_final_processing (void);
137137
extern int z80_dwarf2_addr_size (const bfd *abfd);
138138

139139
/* CFI hooks. */
140+
141+
#define TARGET_USE_CFIPOP 1
142+
140143
#define tc_cfi_frame_initial_instructions z80_tc_frame_initial_instructions
141144
extern void z80_tc_frame_initial_instructions (void);
142145

gdb/dwarf2/unit-head.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ unit_head::read_address (bfd *abfd, const gdb_byte *buf,
202202
case 2:
203203
retval = bfd_get_signed_16 (abfd, buf);
204204
break;
205+
case 3:
206+
{
207+
ULONGEST u = bfd_get_24 (abfd, buf);
208+
retval = (u & 0x800000) ? (ULONGEST) (u | ~((ULONGEST) 0xffffff)) : u;
209+
break;
210+
}
205211
case 4:
206212
retval = bfd_get_signed_32 (abfd, buf);
207213
break;
@@ -220,6 +226,9 @@ unit_head::read_address (bfd *abfd, const gdb_byte *buf,
220226
case 2:
221227
retval = bfd_get_16 (abfd, buf);
222228
break;
229+
case 3:
230+
retval = bfd_get_24 (abfd, buf);
231+
break;
223232
case 4:
224233
retval = bfd_get_32 (abfd, buf);
225234
break;

gdb/z80-tdep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ z80_frame_unwind_cache (const frame_info_ptr &this_frame,
640640
/* Adjust all the saved registers so that they contain addresses and not
641641
offsets. */
642642
for (i = 0; i < gdbarch_num_regs (gdbarch) - 1; i++)
643-
if (info->saved_regs[i].addr () > 0)
643+
if (info->saved_regs[i].is_addr () && info->saved_regs[i].addr () > 0)
644644
info->saved_regs[i].set_addr
645645
(info->prev_sp - info->saved_regs[i].addr () * addr_len);
646646

readme.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
This is a pre-built distribution of GNU binutils for z80-none-elf.
2+
3+
Source: https://github.com/CE-Programming/binutils-gdb.git
4+
Original Source: https://sourceware.org/git/binutils-gdb.git
5+
6+
This software is licensed under the GNU General Public License v3.
7+
See the license directory for full license texts.
8+
9+
Source code is available at the URLs above.
10+
No modifications have been made to the original source.

0 commit comments

Comments
 (0)