Mario Sergio Fujikawa Ferreira
2005-May-08 07:33 UTC
make buildkernel subdirs do not respect COPTFLAGS
Hi,
I was doing my often world build when something came up.
$ make buildworld
just fine
$ make buildkernel
not so good
$ make buildkernel -V CFLAGS
-Os -pipe -march=athlon-xp -falign-functions -falign-jumps -fno-strict-aliasing
-fomit-frame-pointer -fpeel-loops -freorder-blocks -funit-at-a-time
-funswitch-loops -mfpmath=387 -march=athlon-xp
$ make buildkernel -V COPTFLAGS
-Os -pipe -march=athlon-xp -falign-functions -falign-jumps -fno-strict-aliasing
-fomit-frame-pointer -fpeel-loops -freorder-blocks -funit-at-a-time
-funswitch-loops -mfpmath=387
$ make buildkernel -V LDFLAGS
Those are the compile options I have. As you can see, both
COPTFLAGS and CFLAGS contents are the same whereas LDFLAGS is empty.
I did a CVSup then a buildworld, then proceeded to a buildkernel.
Here is what I've got:
cd /usr/src/sys/modules; MAKEOBJDIRPREFIX=/usr/obj/usr/src/sys/LIOUX/modules
KMODDIR=/boot/kernel MACHINE=i386
KERNBUILDDIR="/usr/obj/usr/src/sys/LIOUX" make all
===> 3dfx
===> aac
===> aac/aac_linux
===> accf_data
===> accf_http
===> acpi
===> acpi/acpi
/usr/local/libexec/ccache/cc -O -pipe -pipe -msse -mfpmath=sse,387
-funit-at-a-time -falign-functions -fforce-addr -fforce-mem
-foptimize-register-move -foptimize-sibling-calls -fpeel-loops
-fprefetch-loop-arrays -freorder-blocks -march=athlon-xp
-I/usr/src/sys/modules/acpi/acpi/../../../contrib/dev/acpica -D_KERNEL
-DKLD_MODULE -nostdinc -I-
-I/usr/src/sys/modules/acpi/acpi/../../../contrib/dev/acpica -include
/usr/obj/usr/src/sys/LIOUX/opt_global.h -I. -I@ -I@/contrib/altq -I@/../include
-finline-limit=8000 -fno-common -I/usr/obj/usr/src/sys/LIOUX
-mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow
-mno-sse -mno-sse2 -ffreestanding -Wall -Wredundant-decls -Wnested-externs
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual
-fformat-extensions -std=c99 -Wsystem-headers -Werror -Wall -Wno-format-y2k
-Wno-uninitialized -c
/usr/src/sys/modules/acpi/acpi/../../../contrib/dev/acpica/dsfield.c
/usr/src/sys/modules/acpi/acpi/../../../contrib/dev/acpica/dsfield.c:1: warning:
SSE instruction set disabled, using 387 arithmetics
*** Error code 1
As you can see the FLAGS options being used to build the
kernel DO NOT match either CFLAGS or COPTFLAGS for buildkernel. I
can reproduce this just fine. Let me know if you need a full log
'make buildworld buildkernel'
As you can see below my standard CFLAGS is not the same as
of the one for buildkernel.
$ make -V CFLAGS
-O -pipe -pipe -msse -mfpmath=sse,387 -funit-at-a-time -falign-functions
-fforce-addr -fforce-mem -foptimize-register-move -foptimize-sibling-calls
-fpeel-loops -fprefetch-loop-arrays -freorder-blocks -march=athlon-xp
I trick the system to use different build make options
depending on the given situation.
My /etc/make.conf contains the following
COPTFLAGS=-Os -pipe
COPTFLAGS+=-march=athlon-xp
COPTFLAGS+=-falign-functions
COPTFLAGS+=-falign-jumps
COPTFLAGS+=-fno-strict-aliasing
COPTFLAGS+=-fomit-frame-pointer
COPTFLAGS+=-fpeel-loops
COPTFLAGS+=-freorder-blocks
COPTFLAGS+=-funit-at-a-time
COPTFLAGS+=-funswitch-loops
.if make(buildworld) || make(buildkernel)
LDFLAGS_LD_INSTEAD_OF_CC=yes
NO_CFLAGS=yes
CFLAGS=${COPTFLAGS}
.if make(buildworld)
COPTFLAGS+=-msse
COPTFLAGS+=-mfpmath=sse,387
.elif make(buildkernel) # ! make(buildworld)
COPTFLAGS+=-mfpmath=387
.endif # make(buildkernel)
.endif # make(buildworld) || make(buildkernel)
The botton line is, the following line
cd /usr/src/sys/modules; MAKEOBJDIRPREFIX=/usr/obj/usr/src/sys/LIOUX/modules
KMODDIR=/boot/kernel MACHINE=i386 KERNBUILDDIR="/u
sr/obj/usr/src/sys/LIOUX" make all
has no idea that it is part of a buildkernel statement. We can fix
that by setting a ENVIRONMENT variable when the kernel is being
built and check that within /usr/src/sys/modules in order to respect
COPTFLAGS over CFLAGS.
What do you guys think? I hope my make.conf code tricks are
useful to some folks out there.
Regards,
ps: Plz, CC: me in your responses since I am no longer subscribed
to this mailing list
--
Mario S F Ferreira - DF - Brazil - "I guess this is a signature."
feature, n: a documented bug | bug, n: an undocumented feature
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :
http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20050508/6472921a/attachment.bin
Mario Sergio Fujikawa Ferreira
2005-May-08 07:42 UTC
make buildkernel subdirs do not respect COPTFLAGS
Hi, Just a followup, the modules are also not respecting the command line defines. This is what I've got which is totally wrong since -Wl statements are meant for gcc not ld. ld -Wl,-z,combreloc -Wl,--sort-common -Wl,--enable-new-dtags -d -warn-common -r -d -o acpi.kld dsfield.o dsinit.o dsmethod.o dsmthdat.o dsobject.o dsopcode.o dsutils.o dswexec.o dswload.o dswscope.o dswstate.o evevent.o evgpe.o evgpeblk.o evmisc.o evregion.o evrgnini.o evsci.o evxface.o evxfevnt.o evxfregn.o exconfig.o exconvrt.o excreate.o exdump.o exfield.o exfldio.o exmisc.o exmutex.o exnames.o exoparg1.o exoparg2.o exoparg3.o exoparg6.o exprep.o exregion.o exresnte.o exresolv.o exresop.o exstore.o exstoren.o exstorob.o exsystem.o exutils.o hwacpi.o hwgpe.o hwregs.o hwsleep.o hwtimer.o nsaccess.o nsalloc.o nsdump.o nseval.o nsinit.o nsload.o nsnames.o nsobject.o nsparse.o nssearch.o nsutils.o nswalk.o nsxfeval.o nsxfname.o nsxfobj.o psargs.o psopcode.o psparse.o psscope.o pstree.o psutils.o pswalk.o psxface.o rsaddr.o rscalc.o rscreate.o rsdump.o rsio.o rsirq.o rslist.o rsmemory.o rsmisc.o rsutils.o rsxface.o tbconvrt.o tbget.o tbgetall.o tbinstal.o tbrsdt.o tbutils.o tbxface.o tbxfroot.o utalloc.o utclib.o utcopy.o utdebug.o utdelete.o uteval.o utglobal.o utinit.o utmath.o utmisc.o utobject.o utxface.o acpi.o acpi_button.o acpi_isab.o acpi_package.o acpi_pci.o acpi_pcib.o acpi_pcib_acpi.o acpi_pcib_pci.o acpi_powerres.o acpi_quirk.o acpi_resource.o acpi_timer.o acpi_pci_link.o acpi_thermal.o acpi_acad.o acpi_battery.o acpi_cmbat.o acpi_cpu.o acpi_ec.o acpi_lid.o acpi_throttle.o OsdDebug.o OsdHardware.o OsdInterrupt.o OsdMemory.o OsdSchedule.o OsdStream.o OsdSynch.o OsdTable.o OsdEnvironment.o acpi_machdep.o acpi_wakeup.o madt.o I use a protection define "LDFLAGS_LD_INSTEAD_OF_CC=yes" that TAKES care of that. It is set in the buildkernel statement. That line should have read ld -z combreloc --sort-common --enable-new-dtags -d -warn-common -r -d -o acpi.kld dsfield.o dsinit.o dsmethod.o dsmthdat.o dsobject.o dsopcode.o dsutils.o dswexec.o dswload.o dswscope.o dswstate.o evevent.o evgpe.o evgpeblk.o evmisc.o evregion.o evrgnini.o evsci.o evxface.o evxfevnt.o evxfregn.o exconfig.o exconvrt.o excreate.o exdump.o exfield.o exfldio.o exmisc.o exmutex.o exnames.o exoparg1.o exoparg2.o exoparg3.o exoparg6.o exprep.o exregion.o exresnte.o exresolv.o exresop.o exstore.o exstoren.o exstorob.o exsystem.o exutils.o hwacpi.o hwgpe.o hwregs.o hwsleep.o hwtimer.o nsaccess.o nsalloc.o nsdump.o nseval.o nsinit.o nsload.o nsnames.o nsobject.o nsparse.o nssearch.o nsutils.o nswalk.o nsxfeval.o nsxfname.o nsxfobj.o psargs.o psopcode.o psparse.o psscope.o pstree.o psutils.o pswalk.o psxface.o rsaddr.o rscalc.o rscreate.o rsdump.o rsio.o rsirq.o rslist.o rsmemory.o rsmisc.o rsutils.o rsxface.o tbconvrt.o tbget.o tbgetall.o tbinstal.o tbrsdt.o tbutils.o tbxface.o tbxfroot.o utalloc.o utclib.o utcopy.o utdebug.o utdelete.o uteval.o utglobal.o utinit.o utmath.o utmisc.o utobject.o utxface.o acpi.o acpi_button.o acpi_isab.o acpi_package.o acpi_pci.o acpi_pcib.o acpi_pcib_acpi.o acpi_pcib_pci.o acpi_powerres.o acpi_quirk.o acpi_resource.o acpi_timer.o acpi_pci_link.o acpi_thermal.o acpi_acad.o acpi_battery.o acpi_cmbat.o acpi_cpu.o acpi_ec.o acpi_lid.o acpi_throttle.o OsdDebug.o OsdHardware.o OsdInterrupt.o OsdMemory.o OsdSchedule.o OsdStream.o OsdSynch.o OsdTable.o OsdEnvironment.o acpi_machdep.o acpi_wakeup.o madt.o So, this is yet another thing to consider. ps: Plz, CC: me in your responses since I am no longer subscribed to this mailing list -- Mario S F Ferreira - DF - Brazil - "I guess this is a signature." feature, n: a documented bug | bug, n: an undocumented feature