Skip to content

Build with a binutils 2.46 toolchain (AmigaDev 16.2-rc14) - #205

Merged
tinic merged 3 commits into
tinic:mainfrom
codewiz:build-with-binutils-2.46
Oct 8, 2026
Merged

tinic merged 3 commits into
tinic:mainfrom
codewiz:build-with-binutils-2.46

Conversation

@codewiz

@codewiz codewiz commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Building the tree with a toolchain from AmigaPorts/m68k-amigaos-gcc 16.2-rc14 (gcc 16.2.0b, binutils 2.46, newlib amiga with the crt0 fixes) fails three times. Each is a place where the project encodes binutils 2.39 behaviour; the pinned toolchain is not affected by any of the changes.

Changes

  • crashguard.c: the trap stub's asm() names ami_crash_saved_* and ami_crash_bailout in asm text, which the compiler does not parse, so under -flto the symbols are made local and the stub's relocations point at the LTO plugin's empty placeholder. binutils 2.46 refuses that link ("defined in LTO IR but was made local by the compiler, and a non-LTO object references it"); 2.39 accepted it and relocated the stores to hunk 0, so the crash handler's register save was writing over the start of the first hunk. used keeps the symbols alive but not global; externally_visible does both. GCC-only attribute, which every m68k-amigaos toolchain is.
  • cmake/check-a5-frame.cmake: 2.46's objdump prints move.l d0,-316(a5) as movel d0,a5@(-316); the checker dropped the @(...) and read the remaining a5 as the destination, failing NetShutdown on a plain store into its frame. An operand ending in @ after the parentheses are gone is a memory reference; only a5@- and a5@+ change the register. Two fixtures added, one PASS and one FAIL.
  • tools/fix-toolchain-crt0.py: three gaps made --check refuse a toolchain whose crt0 already carries the upstream fixes for all three bugs. instruction_details() knew only the 2.39 addr size name: symbol line, so under addr <name>: no instruction had a function and no call to main was counted; the 32-bit displacement of the libb32 forms prints in hex without a prefix (a4@(10) for .bss+0x10) and was read as decimal; ixemul's crt0.o, a different runtime with no ____start/exit pair, was counted as "not understood".

Verification

  • cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-m68k-amigaos.cmake configures against the rc14 toolchain; --check reports all eleven newlib crt0.o immune to all three bugs.
  • Full default build (LTO on, CPU any) completes: bsdsocket.library, tls.library, usergroup.library and the four SANA-II drivers, no link or gate errors.
  • tests/toolchain/test_crt0_gate.py still passes. check_a5_frame_cases.cmake: all ten verdicts as expected.

Not touched here: the new -Wcallconv-mismatch from AmigaPorts/gcc#68 fires once, on the n68k_copy_bytes_mv* table in tests/perf/n68kmv.c.

codewiz and others added 3 commits October 8, 2026 12:52
The trap stub names ami_crash_saved_* and ami_crash_bailout in asm text,
which the compiler does not parse, so -flto made them local and the
stub's relocations pointed at the plugin's empty placeholder. binutils
2.46 refuses that link ("defined in LTO IR but was made local by the
compiler"); 2.39 accepted it and the stores went to hunk 0. `used' kept
the symbols alive but not global; externally_visible does both.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
binutils 2.46's objdump prints `move.l d0,-316(a5)' as `movel
d0,a5@(-316)'. The checker dropped the `@(...)' and read the remaining
`a5' as the destination register, failing NetShutdown on a plain store
into its frame. Only `a5@-' and `a5@+' change the register. Two fixtures
added.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Three gaps made the gate refuse a toolchain whose crt0 carries the
upstream fixes for all three bugs:
- instruction_details() only knew the 2.39 `addr size name:' symbol line,
  so under 2.46's `addr <name>:' no instruction had a function and no
  call to main was counted;
- the 32-bit displacement of the libb32 forms prints in hex without a
  prefix (`a4@(10)' for .bss+0x10) and was read as decimal;
- ixemul's crt0.o, a different runtime with no ____start/exit pair, was
  counted as "not understood".
With these, a toolchain built from AmigaPorts/m68k-amigaos-gcc 16.2-rc14
passes --check with all eleven crt0.o immune to all three bugs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codewiz
codewiz force-pushed the build-with-binutils-2.46 branch from a58b27c to 75d5f98 Compare October 8, 2026 03:55
@codewiz codewiz changed the title Build with a binutils 2.46 toolchain (AmigaPorts 16.2-rc14) Build with a binutils 2.46 toolchain (AmigaDev 16.2-rc14) Oct 8, 2026
tinic added a commit that referenced this pull request Oct 8, 2026
toolchain 16.2.5: GCC amiga16.2 134541b3 + binutils 2.46 (includes #205)
@tinic
tinic merged commit 75d5f98 into tinic:main Oct 8, 2026
5 of 37 checks passed
@codewiz
codewiz deleted the build-with-binutils-2.46 branch October 9, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants