compile - How do general binaries take advantage from new instructionsets on new CPUs
2014-04
With every release of a new processor, there are changes to the instructionset the processor supports. For example, Haswell has Advanced Vector Extensions. However, when I run a program on a PC with a Haswell processor I usually run generic AMD64 binaries: the compiler doesn't know these instructions are available. How do these binaries still take advantage of the new instructions added in new architectures?
Unless the binaries were complied to check for extensions and also to use them if they are present, they do not take advantage of new instructions from instruction set extensions.
When trying to compile my own kernel for FreeBSD 8.0, and I'm having some issues. In fact, I can't even re-compile the GENERIC kernel with no changes!
The last few lines before I get errors when running make depend
are...
../../../amd64/amd64/genassym.c:227: error: 'struct pcpu' has no member named 'pc_tss'
../../../amd64/amd64/genassym.c:241: error: 'GUCODE32_SEL' undeclared here (not in a function)
../../../amd64/amd64/genassym.c:242: error: 'GUFS32_SEL' undeclared here (not in a function)
../../../amd64/amd64/genassym.c:243: error: 'GUGS32_SEL' undeclared here (not in a function)
../../../amd64/amd64/genassym.c:246: error: 'SEL_RPL_MASK' undeclared here (not in a function)
*** Error code 1
Stop in /usr/src/sys/i386/compile/GENERIC.
This, again, with no changes to the GENERIC kernel. My custom kernel is only adding VESA and SC_PIXEL_MODE, but errors in the same way.
EDIT: Interestingly enough, when running make cleandepend
, I get the following output, despite compiling on an amd64 machine and install of FreeBSD.
rm -f .depend machine amd64 cd ../../../modules; MAKEOBJDIRPREFIX=/usr/src/sys/i386/compile/SANDERS/modules KMODDIR=/boot/kernel DEBUG_FLAGS="-g" MACHINE=i386 KERNBUILDDIR="/usr/src/sys/i386/compile/SANDERS" SYSDIR="/usr/src/sys/i386/compile/SANDERS/../../.." make cleandepend
===> aac (cleandepend) rm -f @ machine amd64 rm -f .depend GPATH GRTAGS GSYMS GTAGS
===> accf_data (cleandepend) rm -f @ machine amd64 rm -f .depend GPATH GRTAGS GSYMS GTAGS
===> accf_dns (cleandepend) rm -f @ machine amd64 rm -f .depend GPATH GRTAGS GSYMS GTAGS
===> accf_http (cleandepend) rm -f @ machine amd64 rm -f .depend GPATH GRTAGS GSYMS GTAGS
===> acpi (cleandepend)
===> acpi/acpi (cleandepend) "Makefile", line 4: "ACPI can only be compiled into the kernel on the amd64 and ia64 platforms"
*** Error code 1
Stop in /usr/src/sys/modules/acpi.
*** Error code 1
Stop in /usr/src/sys/modules.
*** Error code 1
Stop in /usr/src/sys/i386/compile/SANDERS.
Any insight would be much appreciated :)
EDIT:
Output of uname -a
is
FreeBSD jbirch.net 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:02:08 UTC 2009 [email protected]:/usr/obj/usr/src/sys/GENERIC amd64
and I'm afraid /usr/make.conf
and /usr/src.conf
don't exist. I pulled up the relevant man pages, which told me they usually reside in /etc/
, but they didn't exist there either.
It looks like the system is trying to build an i386 kernel on your amd64 system. Can you post the output of "uname -a", the contents of /usr/make.conf and /usr/src.conf please?
Update:
Having re-read the original question it appears you're not following the standard build process as outlined in the Handbook, which is probably why things are going wrong. You should be running make buildkernel
to build a new kernel, and make installkernel
to install it; make depend
etc. are run as part of the build internally, but haven't been required to be run manually since the 4.x days.