Discussion:
Setting up NetBSD/m68k on qemu-virt for LLVM CI
Add Reply
John Paul Adrian Glaubitz
2025-02-09 08:12:53 UTC
Reply
Permalink
Hi,

after learning that NetBSD uses four bytes alignment on m68k by default and also
seeing that apparently NetBSD has also landed support for the virt machine in qemu
on m68k, I have decided that I would like to switch the m68k buildbot that I am
maintaining for the LLVM CI from Linux/m68k to NetBSD/m68k.

Currently that buildbot is running Linux/m68k which means that it's currently impossible
to build LLVM natively due the two bytes alignment used on Linux/m68k by default:

https://lab.llvm.org/staging/#/builders/91

Would someone here be willing to help me set up the buildbot on NetBSD? My plan
would be to shut down the Linux/m68k virtual machine, move it out of the way and
replace with a NetBSD/m68k virtual machine and switch the CI to build on NetBSD.

FWIW, has anyone here tried building LLVM on NetBSD/m68k? At least a stage1 build
should just work while there might still be some issues that prevent a two-stage
build.

Thanks,
Adrian

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
John Klos
2025-02-09 18:13:52 UTC
Reply
Permalink
Hi,

> Currently that buildbot is running Linux/m68k which means that it's currently impossible
> to build LLVM natively due the two bytes alignment used on Linux/m68k by default:
>
> https://lab.llvm.org/staging/#/builders/91
>
> Would someone here be willing to help me set up the buildbot on NetBSD? My plan
> would be to shut down the Linux/m68k virtual machine, move it out of the way and
> replace with a NetBSD/m68k virtual machine and switch the CI to build on NetBSD.

Happy to help, but as you can see in the discussions here:

https://mail-index.netbsd.org/port-m68k/tindex.html

virt68k can't currently use more than a certain amount of memory, but
getting it set up now for when that'll be fixed wouldn't hurt.

> FWIW, has anyone here tried building LLVM on NetBSD/m68k? At least a
> stage1 build should just work while there might still be some issues
> that prevent a two-stage build.

It was attempted as part of a pbulk build and failed pretty quickly:

[ 12%] Building CXX object
tools/llvm-config/CMakeFiles/llvm-config.dir/llvm-config.cpp.o
[ 12%] Linking CXX executable ../../bin/llvm-config
[ 12%] Built target llvm-config
[ 12%] Building COFFOptions.inc...
[ 12%] Built target JITLinkTableGen
[ 12%] Building AArch64GenAsmWriter.inc...
[ 12%] Building AArch64GenAsmWriter1.inc...
[ 12%] Building AArch64GenCallingConv.inc...
[ 12%] Building AArch64GenDAGISel.inc...
[ 12%] Building AArch64GenDisassemblerTables.inc...
[ 12%] Building AArch64GenExegesis.inc...
[ 12%] Building AArch64GenFastISel.inc...
[ 12%] Building AArch64GenGlobalISel.inc...
LLVM ERROR: out of memory
Allocation failed
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/
and include the crash backtrace.
Stack dump:
0. Program arguments: ../../../bin/llvm-tblgen -gen-global-isel -I
/tmp/pkgbuild/lang/llvm/work.m68k/llvm-18.1.8.src/lib/Target/AArch64
-I/tmp/pkgbuild/lang/llvm/work.m68k/llvm-18.1.8.src/cmake-pkgsrc-build/include
-I/tmp/pkgbuild/lang/llvm/work.m68k/llvm-18.1.8.src/include -I
/tmp/pkgbuild/lang/llvm/work.m68k/llvm-18.1.8.src/lib/Target
/tmp/pkgbuild/lang/llvm/work.m68k/llvm-18.1.8.src/lib/Target/AArch64/AArch64.td
--write-if-changed -o
/tmp/pkgbuild/lang/llvm/work.m68k/llvm-18.1.8.src/cmake-pkgsrc-build/lib/Target/AArch64/AArch64GenGlobalISel.inc
Stack dump without symbol names (ensure you have llvm-symbolizer in your
PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 llvm-tblgen 0x00273c96 llvm::sys::DefaultOneShotPipeSignalHandler() +
5422
1 llvm-tblgen 0x00273fd4 llvm::sys::DefaultOneShotPipeSignalHandler() +
6252
2 llvm-tblgen 0x002722d0 llvm::raw_fd_ostream::~raw_fd_ostream() + 68860
3 llvm-tblgen 0x0027264e llvm::raw_fd_ostream::~raw_fd_ostream() + 69754
4 libc.so.12 0x0e7c407e __sigtramp_siginfo_2 + 0
[1] Abort trap (core dumped) ../../../bin/llvm-tblgen -gen-global-isel
-I /...
*** [lib/Target/AArch64/AArch64GenGlobalISel.inc] Error code 134

make[2]: stopped in
/tmp/pkgbuild/lang/llvm/work.m68k/llvm-18.1.8.src/cmake-pkgsrc-build
1 error

The pbulk stuff takes lots of memory itself, so many things that don't
compile as part of a bulk build work when compiled by itself.

This particular machine is compiling erlang at the moment. When that's
finished, I'll give llvm another try.

But what I really think you're interested in is llvm-target-m68k. With all
the default targets, it'd probably take ages, and llvm-target-m68k isn't
even enabled by default.

John

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Chris Hanson
2025-02-10 00:39:37 UTC
Reply
Permalink
On Feb 9, 2025, at 10:13 AM, John Klos <***@klos.com> wrote:
>
> virt68k can't currently use more than a certain amount of memory, but getting it set up now for when that'll be fixed wouldn't hurt.

It would also help to rebuild your virt68k with 8KB instead of 4KB pages, just as it does for other 68K platforms. Then it’ll at least be able to address the current maximum possible address space.

Honestly, it might just make sense to switch the port to 8KB instead of 4KB pages, even though most 68K ports use 4KB out of the box…

-- Chris


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
John Klos
2025-02-16 01:20:59 UTC
Reply
Permalink
> FWIW, has anyone here tried building LLVM on NetBSD/m68k? At least a stage1 build
> should just work while there might still be some issues that prevent a two-stage
> build.

What do you know? It completed :)

I used:

PKG_OPTIONS.llvm=llvm-target-m68k \
-llvm-target-aarch64 -llvm-target-amdgpu -llvm-target-arc \
-llvm-target-arm -llvm-target-avr -llvm-target-bpf \
-llvm-target-csky -llvm-target-directx -llvm-target-hexagon \
-llvm-target-lanai -llvm-target-loongarch \
-llvm-target-mips -llvm-target-msp430 -llvm-target-nvptx \
-llvm-target-powerpc -llvm-target-riscv -llvm-target-sparc \
-llvm-target-spirv -llvm-target-systemz -llvm-target-ve \
-llvm-target-webassembly -llvm-target-x86 -llvm-target-xcore \
-llvm-target-xtensa

https://www.klos.com/~john/llvm-18.1.8nb3.tgz

It's built from pkgsrc-2024Q4, so all the dependencies can be found here:

https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/m68k/10.0_2024Q4/All/

I haven't run it yet, but this is a start.

John

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...