SPARC64 kernel LLVM compile

Ionut Hristodorescu <[email protected]> Fri, 30 Sep 2022 15:04:47 -0700
Newsgroups gmane.os.openbsd.sparc
Message-ID <[email protected]>
Hi,=20

  I am trying to compile the OpenBSD SPARC64 kernel with LLVM. Here=E2=80=
=99s what I did :

1. first, compile with gcc, save the commands log, replace =E2=80=9Ccc=E2=
=80=9D with =E2=80=9Cclang=E2=80=9D, change some parameters to match clang=
=E2=80=99s (for example, gcc has =E2=80=9C-mno-fpu=E2=80=9D, clang has =E2=
=80=9C-msoft-float=E2=80=9D, etc)
2. compile with clang=20
3. link with the =E2=80=9Cld=E2=80=9D linker in the end - "ld -n -T ld.scri=
pt --warn-common -nopie -o bsd *.o=E2=80=9D
4. make install -> the resulting kernel is copied in /bsd
5. reboot in qemu :=20

qemu-system-sparc64  -m 4g -drive file=3Ddisk.qcow2,if=3Dide,bus=3D0,unit=
=3D0 -nographic
OpenBIOS for Sparc64
Configuration device id QEMU version 1 machine id 0
kernel cmdline=20
CPUs: 1 x SUNW,UltraSPARC-IIi
UUID: 00000000-0000-0000-0000-000000000000
Welcome to OpenBIOS v1.1 built on Jun 21 2022 21:07
  Type 'help' for detailed information
Trying disk:a...
Not a bootable ELF image
Not a bootable a.out image

Loading FCode image...
Loaded 6888 bytes
entry point is 0x4000
Evaluating FCode...
OpenBSD IEEE 1275 Bootblock 2.1
..>> OpenBSD BOOT 1.22
Trying bsd...
Booting /pci@1fe,0/pci@1,1/ide@3/ide@0/disk@0:a/bsd
11635744@0x1000000+5088@0x1b18c20+144268@0x1c00000+4050036@0x1c2338c=20
symbols @ 0xfee48580 239+637704+436800 start=3D0x1480000
[ using 1076152 bytes of bsd ELF symbol table ]
Unimplemented service set-symbol-lookup ([2] -- [0])
Unhandled Exception 0x0000000000000030
PC =3D 0x0000000001493780 NPC =3D 0x0000000001493784
Stopping execution

Any ideas ?=