https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125926
Bug ID: 125926
Summary: set preferred stack boundary for ELF binaries on
NetBSD/m68k to 32 bits
Product: gcc
Version: 16.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: kalvisd at gmail dot com
Target Milestone: ---
Created attachment 64823
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64823&action=edit
proposed patch
Currently, for the ELF target on NetBSD/m68k, the 'STACK_BOUNDARY'
macro is redefined to be 32 - that is, declaring that the minimum
alignment of the stack pointer guaranteed by the hardware is to a 32
bit boundary. (ref section 19.5 "Storage Layout" in the Gnu Compiler
Collection Internals reference).
This is not actually the case - the m68k architecture only requires
(and enforces) alignment to 16 bit boundaries.
To meet the SVR4 ABI requirement to align the stack to a 32-bit
boundary, 'PREFERRED_STACK_BOUNDARY' should be defined instead.
A proposed patch, on behalf of [email protected], to whom credit for this
change should be given, is attached.
This change has been tested in GCC 15.2.0 and GCC 16.1 with no obvious
ill effects.
Regression testing results:
Compiler: GCC 16.1
Host: x86_64-unknown-netbsd11.99 (NetBSD/amd64 11.99)
Target: m68k--netbsdelf (NetBSD/m68k)
Without patch:
cross-compiler terminates abruptly with an assertion failure while
compiling libgcc.
With patch:
tests for c++ and c compilers complete with the following results:
=== g++ Summary ===
# of expected passes 241722
# of unexpected failures 11628
# of unexpected successes 24
# of expected failures 2217
# of unresolved testcases 1187
# of unsupported tests 2391
/gcc/16/gcc-16-amd64--netbsd-m68k--netbsdelf/gcc/xg++ version 16.1.1 20260523
(GCC)
=== gcc Summary ===
# of expected passes 145065
# of unexpected failures 706
# of unexpected successes 10
# of expected failures 1180
# of unresolved testcases 378
# of unsupported tests 4748
/gcc/16/gcc-16-amd64--netbsd-m68k--netbsdelf/gcc/xgcc version 16.1.1 20260523
(GCC)