Relocation error loading 32 bit ARM kernel modules built by devel/llvm18

From: John F Carr <jfc_at_mit.edu>
Date: Mon, 29 Apr 2024 03:13:42 UTC
The ports version of llvm 18 generates 32 bit ARM kernel modules that can't be loaded due to an unsupported relocation type.  The system llvm 18 works.  The ports version of llvm 17 works.

Running "make buildkernel CROSS_TOOLCHAIN=llvm18" changed the relocation type for __stack_chk_guard in umodem.ko from R_ARM_ABS32 to R_ARM_GLOB_DAT, resulting in an error:

kldload: unexpected relocation type 21, symbol index 22
link_elf: symbol __stack_chk_guard undefined

Two compilers based on the same llvm-project git hash give different results:

FreeBSD clang version 18.1.3 (https://github.com/llvm/llvm-project.git llvmorg-18.1.3-0-gc13b7485b879)
clang version 18.1.3 (https://github.com/llvm/llvm-project c13b7485b87909fcf739f62cfa382b55407433c0)

The FreeBSD version works.  The version I compiled from source generates the bad relocation.

What is different about the FreeBSD system compiler?  Does a fix need to go into devel/llvm18?  Should sys/arm/arm/elf_machdep.c handle a new relocation type?

John Carr