NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

PR/55556 CVS commit: src/external/gpl3/gcc/dist/gcc/config/m68k

The following reply was made to PR port-m68k/55556; it has been noted by GNATS.

From: "Rin Okuyama" <>
Subject: PR/55556 CVS commit: src/external/gpl3/gcc/dist/gcc/config/m68k
Date: Mon, 10 Aug 2020 06:24:39 +0000

 Module Name:	src
 Committed By:	rin
 Date:		Mon Aug 10 06:24:39 UTC 2020
 Modified Files:
 	src/external/gpl3/gcc/dist/gcc/config/m68k: netbsd-elf.h
 Log Message:
 PR port-m68k/55556
 Reset STACK_BOUNDARY to default, 16, to fix strange freeze for amiga,
 when kernel is compiled by GCC8.
 For m68k, the stack pointer is required to be aligned to 16-bit boundary
 by architecture. Whereas System V ABI demands it to be aligned to 32-bit
 According to the document, STACK_BOUNDARY is ``the minimum alignment
 enforced by hardware for the stack pointer on this machine.'' Whereas,
 PREFERRED_STACK_BOUNDARY should be used ``if you wish to preserve a
 certain alignment for the stack pointer, greater than what the hardware
 Therefore, STACK_BOUNDARY and PREFERRED_STACK_BOUNDARY should be 16 and
 32, respectively, for m68k. This is how Linux/m68k does.
 GCC 8 generates codes that wisely allocate 64-bit objects on stack by
 using STACK_BOUNDARY. This corrupts the stack frame if it is not properly
 Since the architecture only guarantees the stack pointer to be aligned to
 16-bit boundary, it is not aligned to 32-bit boundary in an instance in
 general. If the interrupt occurs at this moment, the interrupt handler
 spoils the stack frame as explained above, which results in the mysterious
 kernel freezes.
 I guess that similar failures can occur even for userland with signal.
 With this setting, amiga kernel works just fine as far as I can see.
 Furthermore, I've confirmed for amiga, mac68k, and sun3,
 (1)   Kernel compiled by patched GCC8 works with
 (1-a) userland built by GCC7 and non-modified GCC8, and
 (1-b) userland built by patched GCC8.
 (2)   Userland binaries compiled by GCC7 and non-modified GCC8 work fine
       with kernel and base libraries built by patched GCC8.
 (3)   There's no regression observed for tests/kernel, tests/lib/libc/sys,
       and tests/lib/libc/gen.
 This also fixes sun2 kernel to a considerable extent. With non-modified
 GCC8, sun2 kernel crashes in strange ways during the early boot stages.
 With this change, it boots singleuser.
 OK mrg
 To generate a diff of this commit:
 cvs rdiff -u -r1.15 -r1.16 \
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Home | Main Index | Thread Index | Old Index