Re: SPARC64 kernel LLVM compile

Ionut Hristodorescu <[email protected]> Mon, 3 Oct 2022 11:37:01 -0700
Newsgroups gmane.os.openbsd.sparc
Message-ID <[email protected]>
Understood :). BUT : I executed the list of commands spewed out during =
compilation with gcc and I am still not getting a bootable kernel. I =
tried =E2=80=9Cmake SHELL=3D=E2=80=99sh -x=E2=80=99=E2=80=9D (which =
presumably forces make to call each command into a new shell) but still =
no luck. Again - any ideas :) ?

> On Oct 1, 2022, at 3:54 AM, Stuart Henderson <[email protected]> =
wrote:
>=20
> On 2022/09/30 15:04, Ionut Hristodorescu wrote:
>> Hi,=20
>>=20
>>  I am trying to compile the OpenBSD SPARC64 kernel with LLVM. =
Here=E2=80=99s what I did :
>=20
> And now you see why sparc64 hasn't moved across to clang yet :-)
>=20
>>=20
>> 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.script --warn-common -nopie -o bsd *.o=E2=80=9D
>> 4. make install -> the resulting kernel is copied in /bsd
>> 5. reboot in qemu :=20
>>=20
>> qemu-system-sparc64  -m 4g -drive file=3Ddisk.qcow2,if=3Dide,bus=3D0,un=
it=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
>>=20
>> 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
>>=20
>> Any ideas ?