Bug 257549 - ld: error: undefined symbol: xen_clock_init
Summary: ld: error: undefined symbol: xen_clock_init
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Some People
Assignee: Roger Pau Monné
Depends on:
Reported: 2021-08-02 02:24 UTC by andy
Modified: 2021-08-03 01:44 UTC (History)
4 users (show)

See Also:

Fix (3.27 KB, patch)
2021-08-02 08:44 UTC, Roger Pau Monné
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description andy 2021-08-02 02:24:48 UTC
FreeBSD  14.0-CURRENT FreeBSD 14.0-CURRENT #1 main-n247142-441e69e419e: Thu Jun  3 05:18:45 EDT 2021     root@:/usr/obj/usr/src/amd64.amd64/sys/MYKERNEL  amd64 1400018

cc -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -c -O2 -pipe  -fno-strict-aliasing  -g -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -I/usr/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common    -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx  -std=iso9899:1999 -Werror vers.c
ctfconvert -L VERSION -g vers.o
--- kernel.full ---
linking kernel.full
ld: error: undefined symbol: xen_clock_init
>>> referenced by pv.c
>>>               pv.o:(xen_pvh_init_ops)

ld: error: undefined symbol: xen_delay
>>> referenced by pv.c
>>>               pv.o:(xen_pvh_init_ops)
*** [kernel.full] Error code 1

make[2]: stopped in /usr/obj/usr/src/amd64.amd64/sys/MYKERNEL
1 error

make[2]: stopped in /usr/obj/usr/src/amd64.amd64/sys/MYKERNEL
     1452.14 real      2663.46 user       185.09 sys

make[1]: stopped in /usr/src
Comment 1 Li-Wen Hsu freebsd_committer 2021-08-02 02:28:25 UTC
This starts happening in LINT kernel build after a series of xen related commits:

Comment 2 Roger Pau Monné freebsd_committer 2021-08-02 08:44:32 UTC
Created attachment 226870 [details]

The attached patch should fix the issue, will commit very soon unless someone objects.
Comment 3 Dimitry Andric freebsd_committer 2021-08-02 08:49:17 UTC
Looks fine to me :)
Comment 4 commit-hook freebsd_committer 2021-08-02 09:33:26 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=82bf6a2566ba51f2516c16aa7cca6398972c3123

commit 82bf6a2566ba51f2516c16aa7cca6398972c3123
Author:     Roger Pau Monné <royger@FreeBSD.org>
AuthorDate: 2021-08-02 08:22:22 +0000
Commit:     Roger Pau Monné <royger@FreeBSD.org>
CommitDate: 2021-08-02 08:33:35 +0000

    xen/timer: fix amd64 LINT kernel build

    On amd64 XENHVM depends on the xentimer device for PVH early startup,
    so both should be added or removed together (like the current
    dependency with xenpci). Fix this by adding xentimer to NOTES and
    updating the comments on the config files. Note that on i386 there's
    no such dependency between xentimer and XENHVM, since there's no PVH

    While there also fix the MINIMAL i386 build to include the xentimer,
    so it keeps the same functionality as before xentimer was split from

    Reported by: lwhsu
    PR: 257549
    Fixes: ae5981274815 ('xen/timer: make xen timer optional')

 sys/amd64/conf/GENERIC | 4 ++--
 sys/amd64/conf/MINIMAL | 4 +++-
 sys/amd64/conf/NOTES   | 1 +
 sys/i386/conf/MINIMAL  | 1 +
 4 files changed, 7 insertions(+), 3 deletions(-)