# /site/domain/js.berklix.net/etc/make.conf.cflags # Installed by /site/etc/Makefile to # http://berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/jhs/etc/ # See also ./make.conf # WARNING although various flags are discussed here, do Not set them in this # file, else you may destroy the generic nature of the CDROM build engines. # To see what Make macros are called in: # make -V .MAKEFILE_LIST|tr ' ' '\n'|grep -v '\.\.' # CFLAGS += -O # CFLAGS += -O0 # Do not optimize. # If you use multiple -O options, with or without level # numbers, the last such option is the one that is effective. # Message from "David O'Brien" # of "Thu, 02 Jun 2005 01:26:15 PDT." # <20050602082615.GA36096@dragon.NUXI.org> # > > +.if ${MACHINE_ARCH} == "amd64" # > > +CFLAGS+= -minline-all-stringops # > > +.endif # > > + # > Unfortunately we really don't like to put this type of CFLAGS # > in non-*.mk # > files. Since we know the GCC 3.4.2 compiler bugs will be fixed, I # > suggest we just document this issue and be happy that otherwise # > the code # > is ready to go on FreeBSD/amd64. # From: Jung-uk Kim # Date: Thu, 9 Jun 2005 # Don't panic; it is not critical at all. Other critical issues are # fixed in GCC 3.4.4, which is in -CURRENT. On -STABLE, you can use # ports/lang/gcc34 from ports. # From: Oliver Fromme # Date: Wed, 13 Sep 2006 11:05:44 +0200 (CEST) # To: freebsd-stable@freebsd.org # Marc G. Fournier wrote: # > What are ppl currently using for CFLAGS/COPTFLAGS in /etc/make.conf for # > building kernel/world? I know awhile back it wasn't recommended to go # > above -O2, for instance, but suspect that has changed ... ? # # The best optimization is probably to not override the # defaults at all, because they're already pretty optimal. # In fact, by overriding the defaults there's a good chance # to make things worse. :-) # # The default CFLAGS are "-O2 -pipe -fno-strict-aliasing". # Anything above -O2 isn't supported, and using -O2 without # -fno-strict-aliasing also isn't supported (and will create # broken code for some programs). A common mistake is to # specify CFLAGS="-O2 -pipe" and omit -fno-strict-aliasing. # That'll shot you in the foot sooner or later. #---------- # Mark Andrews ? # Lots of code is not strict-aliasing safe. Gcc itself can't # determine all the cases which a construct is not strict-aliasing # safe so even after getting rid of all the warnings gcc # produces you can't be sure your code is strict-aliasing # safe. Think of -fstrict-aliasing as optimisation without # a saftey net. If your code doesn't cast pointers you should # be safe otherwise you need to be really, really, really # careful when you turn this on. # CFLAGS += -g # for gdb debugger # Only on appropriate hosts # CFLAGS += -m486 # CFLAGS += -march=i686 # CFLAGS += -march=pentiumpro # Not if cross compiling. # CFLAGS += -march=pentium # Cross compiling to lapd,lapa,lapl # CFLAGS += -pipe # Uses more swap, so make world breaks on host=park. # The kernel compiles with -O -pipe, without the above. # COPTFLAGS= -pipe -DCOPTFLAGStracethatwillbreakkernel=yes # Warning if you set "COPTFLAGS=-pipe" then kernel will try to compile # without -O and fail to compile here: # cc -c -pipe -Wall -Wredundant-decls -Wnested-externs \ # -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline \ # -Wcast-qual -fformat-extensions -ansi -nostdinc -I- -I. -I../.. \ # -I../../../include -I../../contrib/ipfilter -I/usr/include \ # -D_KERNEL -include opt_global.h -elf -mpreferred-stack-boundary=2 \ # -fomit-frame-pointer ../../i386/i386/atomic.c # In file included from ../../i386/i386/atomic.c:47: # machine/atomic.h: In function `atomic_set_char': # machine/atomic.h:106: inconsistent operand constraints in an `asm' # From: "David O'Brien" # Date: Mon, 7 Mar 2005 22:09:10 -0800 (Tue 07:09 CET) # To: freebsd-amd64 @ freebsd.org # > Is -O2 optimization supported in amd64? It most definitely doesn't work: # It is suppored w/in /usr/src. # -O2 isn't supported in /usr/ports without -fno-strict-aliasing also. # There are a few ports that aren't happy being compiled with any form of # -O2 (such as the old perl). # CFLAGS += -minline-all-stringops # Sender: owner-freebsd-amd64 @ freebsd.org # On Wed, Jun 01, 2005 at 06:33:12PM -0400, Jung-uk Kim wrote: # > The kernel module doesn't load because of an amd64-specific GCC 3.4 # > optimization bug. To work around: # > RCS file: /home/ncvs/src/sys/modules/reiserfs/Makefile,v # > diff -u -r1.1 Makefile # > --- Makefile 24 May 2005 12:30:13 -0000 1.1 # > +++ Makefile 1 Jun 2005 22:22:52 -0000 # > @@ -8,4 +8,8 @@ # > reiserfs_namei.c reiserfs_prints.c reiserfs_stree.c \ # > reiserfs_vfsops.c reiserfs_vnops.c # > +.if ${MACHINE_ARCH} == "amd64" # > +CFLAGS+= -minline-all-stringops # > +.endif # Unfortunately we really don't like to put this type of CFLAGS in non-*.mk # files. Since we know the GCC 3.4.2 compiler bugs will be fixed, I # suggest we just document this issue and be happy that otherwise the code # is ready to go on FreeBSD/amd64. # -- David (obrien @ FreeBSD.org)