Undefined reference to read_random when building kernel(s)

R. Tyler Croy tyler at monkeypox.org
Mon Dec 19 20:15:04 UTC 2016


I have tried this with the latest commits in both 11-STABLE and 12-CURRENT and
they have resulted in the same issue when linking my kernel. I'm unclear what
could be the cause, but since I am only seeing it on my i386 machines I figured
I would ask here.

Here's the relevant log snippet

    MAKE=make sh /usr/src/sys/conf/newvers.sh  GENERIC
    cc -target i386-unknown-freebsd12.0 --sysroot=/usr/obj/usr/src/tmp -B/usr/obj/usr/src/tmp/usr/bin -c -O -pipe  -g -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h   -mno-mmx -mno-sse -msoft-float -ffreestanding -fwrapv -fstack-protector -gdwarf-2 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -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  -mno-aes -mno-avx  -std=iso9899:1999 -Werror  vers.c
    ctfconvert -L VERSION -g vers.o
    linking kernel.full
    random_infra.o:(.data+0x6c): undefined reference to `random_alg_context'
    kern_mib.o: In function `sysctl_kern_arnd':
    /usr/src/sys/kern/kern_mib.c:167: undefined reference to `read_random'
    arc4random.o: In function `arc4_randomstir':
    /usr/src/sys/libkern/arc4random.c:73: undefined reference to `read_random'
    sctp_auth.o: In function `sctp_generate_random_key':
    /usr/src/sys/netinet/sctp_auth.c:326: undefined reference to `read_random'
    sctp_auth.o: In function `sctp_initialize_auth_params':
    /usr/src/sys/netinet/sctp_auth.c:1997: undefined reference to `read_random'
    sctp_output.o: In function `sctp_send_initiate_ack':
    /usr/src/sys/netinet/sctp_output.c:5976: undefined reference to `read_random'
    sctp_pcb.o:/usr/src/sys/netinet/sctp_pcb.c:2592: more undefined references to `read_random' follow
    ivy.o: In function `rdrand_modevent':
    /usr/src/sys/dev/random/ivy.c:115: undefined reference to `random_source_deregister'
    /usr/src/sys/dev/random/ivy.c:108: undefined reference to `random_source_register'
    nehemiah.o: In function `nehemiah_modevent':
    /usr/src/sys/dev/random/nehemiah.c:136: undefined reference to `random_source_deregister'
    /usr/src/sys/dev/random/nehemiah.c:127: undefined reference to `random_source_register'
    *** Error code 1

    Stop.
    make[2]: stopped in /usr/obj/usr/src/sys/GENERIC
    *** Error code 1

    Stop.
    make[1]: stopped in /usr/src
    *** Error code 1

    Stop.
    make: stopped in /usr/src


And some relevant system information:

    root at lemon:/usr/src # cc --version
    FreeBSD clang version 3.4 (tags/RELEASE_34/final 197956) 20140216
    Target: i386-unknown-freebsd11.0
    Thread model: posix
    root at lemon:/usr/src # uname -a
    FreeBSD lemon 11.0-CURRENT FreeBSD 11.0-CURRENT #0 59b8a68(master): Mon Apr 28 04:46:00 UTC 2014     tyler at lemon:/usr/home/tyler/obj/usr/home/tyler/source/github/freebsd/sys/VT  i386


Any suggestions on how to debug/identify the issue here? I'm at a bit of a loss
for debugging kernel link errors :(

- R. Tyler Croy

------------------------------------------------------
     Code: <https://github.com/rtyler>
  Chatter: <https://twitter.com/agentdero>

  % gpg --keyserver keys.gnupg.net --recv-key 1426C7DC3F51E16F
------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-i386/attachments/20161219/d3aa38bf/attachment.sig>


More information about the freebsd-i386 mailing list