Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Sep 2024 18:57:05 +0100
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        Dennis Clarke <dclarke@blastwave.org>
Cc:        "riscv@freebsd.org" <riscv@FreeBSD.org>, John Baldwin <jhb@freebsd.org>
Subject:   Re: kldxref: /boot/kernel/kernel: no ELF relocation table found
Message-ID:  <02D984C2-3505-4E61-BC24-21E9E5249F70@freebsd.org>
In-Reply-To: <8a58b38a-b7fb-494e-a730-e4c341aaa9ee@blastwave.org>
References:  <8a58b38a-b7fb-494e-a730-e4c341aaa9ee@blastwave.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2 Sep 2024, at 11:54, Dennis Clarke <dclarke@blastwave.org> wrote:
>=20
>=20
> All:
>=20
>    Ye ol "make installkernel" starts nicely but ends a little odd :
>=20
>=20
> e# make installkernel
> --------------------------------------------------------------
> >>> Install check kernel
> --------------------------------------------------------------
> --------------------------------------------------------------
> >>> Installing kernel GENERIC on Mon Sep  2 10:10:05 UTC 2024
> --------------------------------------------------------------
> cd /usr/obj/usr/src/riscv.riscv64/sys/GENERIC;  MACHINE_ARCH=3Driscv64 =
MACHINE=3Driscv  CPUTYPE=3D CC=3D"cc -target riscv64-unknown-freebsd15.0 =
--sysroot=3D/usr/obj/usr/src/riscv.riscv64/tmp =
-B/usr/obj/usr/src/riscv.riscv64/tmp/usr/bin" CXX=3D"c++  -target =
riscv64-unknown-freebsd15.0 --sysroot=3D/usr/obj/usr/src/riscv.riscv64/tmp=
 -B/usr/obj/usr/src/riscv.riscv64/tmp/usr/bin"  CPP=3D"cpp -target =
riscv64-unknown-freebsd15.0 --sysroot=3D/usr/obj/usr/src/riscv.riscv64/tmp=
 -B/usr/obj/usr/src/riscv.riscv64/tmp/usr/bin"  AS=3D"as" AR=3D"ar" =
ELFCTL=3D"elfctl" LD=3D"ld"  LLVM_LINK=3D"" NM=3Dnm OBJCOPY=3D"objcopy" =
RANLIB=3Dranlib STRINGS=3D  SIZE=3D"size" STRIPBIN=3D"strip" =
PATH=3D/usr/obj/usr/src/riscv.riscv64/tmp/bin:/usr/obj/usr/src/riscv.riscv=
64/tmp/usr/sbin:/usr/obj/usr/src/riscv.riscv64/tmp/usr/bin:/usr/obj/usr/sr=
c/riscv.riscv64/tmp/legacy/usr/sbin:/usr/obj/usr/src/riscv.riscv64/tmp/leg=
acy/usr/bin:/usr/obj/usr/src/riscv.riscv64/tmp/legacy/bin:/usr/obj/usr/src=
/riscv.riscv64/tmp/legacy/usr/libexec::/sbin:/bin:/usr/sbin:/usr/bin  =
make  KERNEL=3Dkernel METALOG=3D  install
> thiskernel=3D`sysctl -n kern.bootfile || echo /boot/kernel/kernel` ;  =
if [ ! "`dirname "$thiskernel"`" -ef /boot/kernel ] ; then  chflags -R =
noschg /boot/kernel ;  rm -rf /boot/kernel ;  rm -rf =
/usr/lib/debug/boot/kernel ;  else  if [ -d /boot/kernel.old ] ; then  =
chflags -R noschg /boot/kernel.old ;  rm -rf /boot/kernel.old ;  fi ;  =
mv /boot/kernel /boot/kernel.old ;  if [ -n "/usr/lib/debug" -a  -d =
/usr/lib/debug/boot/kernel ]; then  rm -rf =
/usr/lib/debug/boot/kernel.old ;  mv /usr/lib/debug/boot/kernel =
/usr/lib/debug/boot/kernel.old ;  fi ;  sysctl =
kern.bootfile=3D/boot/kernel.old/"`basename "$thiskernel"`" ;  fi
> kern.bootfile: /boot/kernel/kernel -> /boot/kernel.old/kernel
> mkdir -p /boot/kernel
> install -p -m 444 -o root -g wheel kernel /boot/kernel/
> mkdir -p /usr/lib/debug/boot/kernel
> install -p -m 444 -o root -g wheel kernel.debug =
/usr/lib/debug/boot/kernel/
> cd /usr/src/sys/modules; =
MAKEOBJDIRPREFIX=3D/usr/obj/usr/src/riscv.riscv64/sys/GENERIC/modules =
KMODDIR=3D/boot/kernel MACHINE_CPUARCH=3Driscv MACHINE=3Driscv =
MACHINE_ARCH=3Driscv64 MODULES_EXTRA=3D"dtb/sifive" WITHOUT_MODULES=3D"" =
ARCH_FLAGS=3D"" DEBUG_FLAGS=3D"-g" __MPATH=3D"" =
KERNBUILDDIR=3D"/usr/obj/usr/src/riscv.riscv64/sys/GENERIC" =
SYSDIR=3D"/usr/src/sys" MODULE_TIED=3Dyes WITH_CTF=3D"1" make  install
> =3D=3D=3D> accf_data (install)
> install -T release -o root -g wheel -m 444   accf_data.ko =
/boot/kernel/
> install -T dbg -o root -g wheel -m 444   accf_data.ko.debug =
/usr/lib/debug/boot/kernel/
> =3D=3D=3D> accf_dns (install)
> install -T release -o root -g wheel -m 444   accf_dns.ko /boot/kernel/
> install -T dbg -o root -g wheel -m 444   accf_dns.ko.debug =
/usr/lib/debug/boot/kernel/
> .
> .
> .  etc etc etc
> .
> .
> =3D=3D=3D> xz (install)
> install -T release -o root -g wheel -m 444   xz.ko /boot/kernel/
> install -T dbg -o root -g wheel -m 444   xz.ko.debug =
/usr/lib/debug/boot/kernel/
> =3D=3D=3D> zfs (install)
> install -T release -o root -g wheel -m 444   zfs.ko /boot/kernel/
> install -T dbg -o root -g wheel -m 444   zfs.ko.debug =
/usr/lib/debug/boot/kernel/
> =3D=3D=3D> zlib (install)
> install -T release -o root -g wheel -m 444   zlib.ko /boot/kernel/
> install -T dbg -o root -g wheel -m 444   zlib.ko.debug =
/usr/lib/debug/boot/kernel/
> kldxref /boot/kernel
> kldxref: /boot/kernel/kernel: no ELF relocation table found
>=20
> --------------------------------------------------------------
> >>> Installing kernel GENERIC completed on Mon Sep  2 10:13:55 UTC =
2024
> --------------------------------------------------------------
>=20
>=20
>=20
>=20
> So then ... "no ELF relocation table found"?
>=20
> Looking at =
https://cgit.freebsd.org/src/tree/usr.sbin/kldxref/ef.c#n220
> and then downwards to line 367 :
>=20
>    if (rel_off =3D=3D 0 && rela_off =3D=3D 0) {
>        warnx("%s: no ELF relocation table found\n", ef->ef_name);
>        error =3D EFTYPE;
>        goto out;
>    }
>=20
> Which makes me wonder about the ( I hope ) harmless output from this :
>=20
>=20
> # kldxref -dv /boot/kernel
> /boot/kernel/accf_data.ko
>  module accf_data
>  depends on kernel.1500023 (1500023,1500023)
>  interface accf_data.1
> /boot/kernel/accf_dns.ko
>  module accf_dns
>  depends on kernel.1500023 (1500023,1500023)
>  interface accf_dns.1
> .
> .
> .
> /boot/kernel/kern_testfrwk.ko
>  module kern_testframework
>  interface kern_testframework.1
>  depends on kernel.1500023 (1500023,1500023)
> /boot/kernel/kernel
> kldxref: /boot/kernel/kernel: no ELF relocation table found
>=20
> kldxref: /boot/kernel/kernel: not a valid DSO or object file: =
Inappropriate file type or format
> /boot/kernel/kgssapi.ko
>  module kgssapi
>  depends on kernel.1500023 (1500023,1500023)
>  depends on xdr.1 (1,1)
>  depends on krpc.1 (1,1)
>  interface kgssapi.1
> .
> .
> .
>=20
> etc etc
>=20
> .
> .
> .
>=20
>=20
>=20
>=20
>=20
> Also I do see this was created :
>=20
> e# ls -lapb /boot/kernel/linker.hints
> -rw-r--r--  1 root wheel 212416 Sep  2 10:13 /boot/kernel/linker.hints
> e#
>=20
> Looking over the output from "readelf -delV /boot/kernel.old/kernel" =
as
> well as this new kernel they both look very similar. Addresses and =
some
> other bits changed of course.
>=20
> So therefore the situation :
>=20
>    ( 1 )  well understood and just a normal red herring[1]
>=20
>    ( 2 )  ignore it
>=20
>    ( 3 )  huh? that's weird. never saw that before.
>=20
> Curious what is going on there.

It=E2=80=99s a harmless warning from an overly-careful set of checks. =
The tool
was refactored and this case went from being ignored to warning. =
Cc=E2=80=99ing
jhb@ to remind him of this as I pointed it out a while ago.

Jess




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?02D984C2-3505-4E61-BC24-21E9E5249F70>