How does bootinfo64.c find read_eflags() and write_eflags() on amd64?



/usr/src/sys/boot/i386/libi386/bootinfo64.c uses read_eflags() and
write_eflags(), which live as inline functions in
/usr/src/sys/i386/include/cpufunc.h.
/usr/src/sys/boot/i386/libi386/bootinfo64.c also includes
/usr/include/machine/cpufunc.h, but that is
/usr/src/sys/amd64/include/cpufunc.h on amd64, which does not contain
either of them.

I do not understand how FreeBSD's build system finds these. I am trying
to build /usr/src/sys/boot on Gentoo Linux, but Gentoo Linux does not
understand this either:

# env CFLAGS="-march=core2 -mtune=core2 -O2 -pipe -O2
-fno-strict-aliasing -D__FreeBSD__=9 -D__FBSDID\(x\)= -nostdinc
-I/var/tmp/portage/sys-boot/boot0-9.0/work/include_proper"
MACHINE_CPUARCH=amd64 MACHINE_ARCH=amd64
MAKESYSPATH=/usr/share/mk/freebsd pmake
Warning: Object directory not changed from original
/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader
cc -march=core2 -mtune=core2 -O2 -pipe -O2 -fno-strict-aliasing
-D__FreeBSD__=9 -D__FBSDID\(x\)= -nostdinc
-I/var/tmp/portage/sys-boot/boot0-9.0/work/include_proper
-DLOADER_NFS_SUPPORT -DBOOT_FORTH
-I/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../../ficl
-I/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../../ficl/i386
-DLOADER_GZIP_SUPPORT -DLOADER_GPT_SUPPORT
-I/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../../common
-I. -Wall
-I/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/..
-I/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../btx/lib
-ffreestanding -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow
-mno-sse -mno-sse2 -mno-sse3 -msoft-float -m32 -march=i386 -std=gnu99
-static -Wl,-Ttext,0x0 -nostdlib -Wl,-m,elf_i386 -o loader.sym
/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../btx/lib/crt0.o
main.o conf.o vers.o boot.o commands.o console.o devopen.o disk.o
interp.o interp_backslash.o interp_parse.o ls.o misc.o module.o panic.o
load_elf32.o load_elf32_obj.o reloc_elf32.o load_elf64.o
load_elf64_obj.o reloc_elf64.o bcache.o isapnp.o pnp.o interp_forth.o
/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../../ficl/libficl.a

/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../libi386/libi386.a
/usr/lib/libstand.a
/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader/../libi386/libi386.a(bootinfo64.o):
In function `bi_load64':
bootinfo64.c:(.text+0x45a): undefined reference to `read_eflags'
bootinfo64.c:(.text+0x469): undefined reference to `write_eflags'
bootinfo64.c:(.text+0x46e): undefined reference to `read_eflags'
collect2: ld returned 1 exit status
*** Error code 1

Stop.
pmake: stopped in
/var/tmp/portage/sys-boot/boot0-9.0/work/sys/boot/i386/loader

How does bootinfo64.c obtain these symbols on FreeBSD?

Attachment: signature.asc
Description: OpenPGP digital signature



Relevant Pages

  • Re: How does bootinfo64.c find read_eflags() and write_eflags() on amd64?
    ... Warning: Object directory not changed from original ... How does bootinfo64.c obtain these symbols on FreeBSD? ... Via patterns like the following sprinkled around Makefiles under ...
    (freebsd-hackers)
  • Re: Cleaning up FILE in stdio..
    ... Macros and __inline functions mean that a significant proportion of ... software compiled on FreeBSD has the existing definition of FILE ... glibc handles this just fine) ... Remove the macros and inlines that poke around inside FILE ...
    (freebsd-arch)