Re: fix building and linking kernel on sparc64 by clang

Theo Buehler <[email protected]>
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
On Tue, Jun 23, 2026 at 06:33:05PM +0200, Kirill A. Korinsky wrote:
> tech@,
> 
> I'd like to commit this diff as separated pieces, but sending it as single
> one seems the right way to test it.
> 
> So, here small and nessesary changes to build kernel by clang and link it by
> ld.lld on sparc64.
> 
> To make it works you actually need switch sparc64 to clang and lld arch in
> bsd.own.mk by this:
> 
>   Index: share/mk/bsd.own.mk
>   ===================================================================
>   RCS file: /cvs/src/share/mk/bsd.own.mk,v
>   diff -u -p -r1.216 bsd.own.mk
>   --- share/mk/bsd.own.mk	17 Nov 2025 16:06:09 -0000	1.216
>   +++ share/mk/bsd.own.mk	23 Jun 2026 12:48:19 -0000
>   @@ -16,8 +16,8 @@ SKEY?=		yes
>    YP?=		yes
> 
>    CLANG_ARCH=aarch64 amd64 arm i386 mips64 mips64el powerpc powerpc64 riscv64 sparc64
>   -GCC4_ARCH=alpha hppa m88k sh sparc64
>   -LLD_ARCH=aarch64 amd64 arm i386 powerpc powerpc64 riscv64
>   +GCC4_ARCH=alpha hppa m88k sh
>   +LLD_ARCH=aarch64 amd64 arm i386 powerpc powerpc64 riscv64 sparc64
>    LLDB_ARCH=aarch64 amd64
> 
> clzdi2 is licensed under public domain like other files nearby, but it is
> quite trivial.
> 
> Tested by me as clang and gcc based build of kernel, and by tb@ with
> rebuilding llvm and linking and booting kernel which is built by clang + lld.

I can confirm that this is the diff I tested and that the resulting
kernel works.

Not my area to ok things, though.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.