[openib-general] respect CFLAGS in OSM

Eitan Zahavi eitan at mellanox.co.il
Mon Jan 23 05:27:13 PST 2006


Hi Pete,

I have looked again at this patch and what it is changing. 
My understanding is that you found the -g -O2 CLFAGS (provided through
the specific target CFLAGS) unneeded. You also think they will interfere
with settings you might want to provide from the command line. 

I have just double checked what I new to be the rule for autoconf:
If the user provides CFLAGS or LDFLAGS from the command like - they are
appended to the compile or link flags. The impact on gcc is that the
later settings - i.e. those provided by the user take precedence over
the flags provided at the beginning of the command line. So the patch
below is actually not needed. 

Just to convince you I attach some gcc traces showing that -O0 -O2 acts
like -O2 and 
-O2 -O0 acts like -O0.

Bottom line I would like to keep the code as it is without any change
such that default installation will use the -O2 mode.


Eitan Zahavi
Design Technology Director
Mellanox Technologies LTD
Tel:+972-4-9097208
Fax:+972-4-9593245
P.O. Box 586 Yokneam 20692 ISRAEL

swlab25:/home/eitan/SW/work/examples>/usr/libexec/gcc/i386-redhat-linux/
4.0.0/cc1 getHostName.c getHostName.c -auxbase getHostName -O0 -O2
-version -o /tmp/ccet3OkS.s
GNU C version 4.0.0 20050519 (Red Hat 4.0.0-8) (i386-redhat-linux)
        compiled by GNU C version 4.0.0 20050519 (Red Hat 4.0.0-8).
GGC heuristics: --param ggc-min-expand=99 --param
ggc-min-heapsize=129317
options passed:  -auxbase -O0 -O2
options enabled:  -falign-loops -fargument-alias -fbranch-count-reg
 -fcaller-saves -fcommon -fcprop-registers -fcrossjumping
 -fcse-follow-jumps -fcse-skip-blocks -fdefer-pop
 -fdelete-null-pointer-checks -feliminate-unused-debug-types
 -fexpensive-optimizations -fforce-mem -ffunction-cse -fgcse -fgcse-lm
 -fguess-branch-probability -fident -fif-conversion -fif-conversion2
 -fivopts -fkeep-static-consts -fleading-underscore -floop-optimize
 -floop-optimize2 -fmath-errno -fmerge-constants
-foptimize-register-move
 -foptimize-sibling-calls -fpcc-struct-return -fpeephole -fpeephole2
 -fregmove -freorder-blocks -freorder-functions -frerun-cse-after-loop
 -frerun-loop-opt -fsched-interblock -fsched-spec
-fsched-stalled-insns-dep
 -fsplit-ivs-in-unroller -fstrength-reduce -fstrict-aliasing
-fthread-jumps
 -ftrapping-math -ftree-ccp -ftree-ch -ftree-copyrename -ftree-dce
 -ftree-dominator-opts -ftree-dse -ftree-fre -ftree-loop-im
 -ftree-loop-ivcanon -ftree-loop-optimize -ftree-lrs -ftree-pre
-ftree-sra
 -ftree-ter -funit-at-a-time -fvar-tracking -fzero-initialized-in-bss
 -m80387 -mhard-float -mno-soft-float -mieee-fp -mfp-ret-in-387
 -mno-red-zone -mtls-direct-seg-refs -mtune=i386 -march=i386

swlab25:/home/eitan/SW/work/examples>/usr/libexec/gcc/i386-redhat-linux/
4.0.0/cc1 getHostName.c getHostName.c -auxbase getHostName -O2 -O0
-version -o /tmp/ccet3OkS.s
GNU C version 4.0.0 20050519 (Red Hat 4.0.0-8) (i386-redhat-linux)
        compiled by GNU C version 4.0.0 20050519 (Red Hat 4.0.0-8).
GGC heuristics: --param ggc-min-expand=99 --param
ggc-min-heapsize=129317
options passed:  -auxbase -O2 -O0
options enabled:  -falign-loops -fargument-alias -fbranch-count-reg
 -fcommon -feliminate-unused-debug-types -ffunction-cse -fgcse-lm
-fident
 -fivopts -fkeep-static-consts -fleading-underscore -floop-optimize2
 -fmath-errno -fpcc-struct-return -fpeephole -fsched-interblock
 -fsched-spec -fsched-stalled-insns-dep -fsplit-ivs-in-unroller
 -ftrapping-math -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize
 -funit-at-a-time -fvar-tracking -fzero-initialized-in-bss -m80387
 -mhard-float -mno-soft-float -mieee-fp -mfp-ret-in-387 -mno-red-zone
 -mtls-direct-seg-refs -mtune=i386 -march=i386

> -----Original Message-----
> From: openib-general-bounces at openib.org [mailto:openib-general-
> bounces at openib.org] On Behalf Of Pete Wyckoff
> Sent: Thursday, January 19, 2006 11:50 PM
> To: openib-general at openib.org
> Subject: [openib-general] respect CFLAGS in OSM
> 
> I do something like:
> 
>     CFLAGS=-g ./configure ...
> 
> to build a debug tree from openib svn.
> 
> Some places override this CFLAGS setting, though, applying
> optimization even though I explicitly do not want it.  This patch
> fixes that.  These apply to OSM below gen2/trunk/src/userspace/.
> 
> Signed-off-by: Pete Wyckoff <pw at osc.edu>
> 
> Index: management/osm/libvendor/Makefile.am
> ===================================================================
> --- management/osm/libvendor/Makefile.am	(revision 5098)
> +++ management/osm/libvendor/Makefile.am	(working copy)
> @@ -3,8 +3,6 @@
> 
>  if DEBUG
>  DBGFLAGS = -ggdb -D_DEBUG_
> -else
> -DBGFLAGS = -g -O2
>  endif
> 
>  INCLUDES = $(OSMV_INCLUDES)
> Index: management/osm/complib/Makefile.am
> ===================================================================
> --- management/osm/complib/Makefile.am	(revision 5098)
> +++ management/osm/complib/Makefile.am	(working copy)
> @@ -5,8 +5,6 @@
> 
>  if DEBUG
>  DBGFLAGS = -ggdb -D_DEBUG_
> -else
> -DBGFLAGS = -g -O2
>  endif
> 
>  libosmcomp_la_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -
> D_BSD_SOURCE=1
> Index: management/osm/opensm/Makefile.am
> ===================================================================
> --- management/osm/opensm/Makefile.am	(revision 5098)
> +++ management/osm/opensm/Makefile.am	(working copy)
> @@ -5,8 +5,6 @@
> 
>  if DEBUG
>  DBGFLAGS = -ggdb -D_DEBUG_
> -else
> -DBGFLAGS = -g -O2
>  endif
> 
>  libopensm_la_CFLAGS = -Wall $(OSMV_CFLAGS) -DVENDOR_RMPP_SUPPORT
> $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
> _______________________________________________
> openib-general mailing list
> openib-general at openib.org
> http://openib.org/mailman/listinfo/openib-general
> 
> To unsubscribe, please visit
http://openib.org/mailman/listinfo/openib-general



More information about the general mailing list