Re: git: 0840bdbf2a07 - main - Don't try and run kldxref for arm kernels

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 14 Dec 2023 17:48:50 UTC
On 12/14/23 8:44 AM, Jessica Clarke wrote:
> The branch main has been updated by jrtc27:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=0840bdbf2a07b68e29267bc49057ca6df2351360
> 
> commit 0840bdbf2a07b68e29267bc49057ca6df2351360
> Author:     Jessica Clarke <jrtc27@FreeBSD.org>
> AuthorDate: 2023-12-14 16:40:08 +0000
> Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
> CommitDate: 2023-12-14 16:40:08 +0000
> 
>      Don't try and run kldxref for arm kernels
>      
>      Surprisingly, kldxref does not currently support arm, and unhelpfully
>      this means it silently does nothing rather than give an error, so the
>      linker.hints entry added to the METALOG for -DNO_ROOT builds (and
>      pkgbase ones) refers to a file that doesn't exist. Ideally it would be
>      supported (and ideally the METALOG handling would be less fragile, but
>      without integrating it into kldxref the only real option would be to
>      just run find(1) to get the list of linker.hints files, which feels a
>      little backwards), but for now just paper over this by skipping the
>      build step on arm.
>      
>      Reported by:    bapt
>      Fixes:          ff7c12c1f17e ("Make kldxref a bootstrap tool and use unconditionally")
> ---
>   sys/conf/kmod.mk     | 3 ++-
>   sys/modules/Makefile | 3 ++-
>   2 files changed, 4 insertions(+), 2 deletions(-)

I think before the libelf changes it was creating a file, but with only a single
version record.  Now it defers emitting the version record until it emits at least
one "real" record since it doesn't know which endianness to use until it has
successfully opened and parsed a file.  As a result it is now leaving the file
empty rather than with the version record.

It should not be hard to add ef_arm.c to fix for arm.

Another fun project btw would be for someone to add a "read" mode to kldxref to
read a linker.hints file and dump the contents in a human readable fashion similar
to the output one gets from 'kldxref -d'.

-- 
John Baldwin