Bug 248763 - Kernel built with LLVM 11 doesn't boot on powerpc64
Summary: Kernel built with LLVM 11 doesn't boot on powerpc64
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: powerpc Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-19 21:24 UTC by Piotr Kubaj
Modified: 2021-12-22 10:07 UTC (History)
6 users (show)

See Also:


Attachments
Compiler fix for kernel failure (880 bytes, patch)
2020-08-20 20:26 UTC, Brandon Bergren
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer freebsd_triage 2020-08-19 21:24:01 UTC
After upgrading past LLVM 11 import, I can't boot kernel. Console output stops after:
[   42.544826] kexec_core: Starting new kernel
KDB: debugger backends: ddb
KDB: current backend: ddb

Rebuilding kernel from known-to-work revision with LLVM 11 also causes this issue, which is why it must be a compiler problem.
Comment 1 Brandon Bergren 2020-08-20 20:26:13 UTC
Created attachment 217398 [details]
Compiler fix for kernel failure

It turned out that this is an LLVM bug in code generation of mtsprg0-3. When a ppc64 variant was added, typos were introduced that prevented it from working correctly.
Comment 2 Brandon Bergren 2020-08-20 20:50:00 UTC
Reported upstream to https://bugs.llvm.org/show_bug.cgi?id=47259
Comment 3 commit-hook freebsd_committer freebsd_triage 2020-08-21 10:06:26 UTC
A commit references this bug:

Author: dim
Date: Fri Aug 21 10:06:01 UTC 2020
New revision: 364455
URL: https://svnweb.freebsd.org/changeset/base/364455

Log:
  Merge commit 95e18b2d9d5f from llvm git (by Kang Zhang):

    [PowerPC] Fix a typo for InstAlias of mfsprg

    D77531 has a type for mfsprg, it should be mtsprg. This patch is to
    fix this typo.

  This should fix booting powerpc64 kernels, after LLVM 11 was imported.

  PR:		248763

Changes:
  head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstr64Bit.td
Comment 4 Brandon Bergren freebsd_committer freebsd_triage 2020-08-24 21:51:07 UTC
Fixed by the updated LLVM toolchain.
Comment 5 commit-hook freebsd_committer freebsd_triage 2021-12-22 10:07:19 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=a0108291bcc067384d5f70749ba6869e3390cda3

commit a0108291bcc067384d5f70749ba6869e3390cda3
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2020-08-21 10:06:01 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-12-22 09:58:32 +0000

    Merge commit 95e18b2d9d5f from llvm git (by Kang Zhang):

      [PowerPC] Fix a typo for InstAlias of mfsprg

      D77531 has a type for mfsprg, it should be mtsprg. This patch is to
      fix this typo.

    This should fix booting powerpc64 kernels, after LLVM 11 was imported.

    PR:             248763
    (cherry picked from commit 2a99bea5784f4b347a70967fe4b8faf1c7280f79)

 contrib/llvm-project/llvm/lib/Target/PowerPC/PPCInstr64Bit.td | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)