[Olsr-cvs] olsrd-current Makefile.inc,1.47,1.48

Bernd Petrovitsch (spam-protected)
Thu Dec 6 21:13:58 CET 2007


Update of /cvsroot/olsrd/olsrd-current
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28859

Modified Files:
	Makefile.inc 
Log Message:
- added "-ffunction-sections -fdata-sections -Wl,--print-gc-sections" and
  comnmented them out:
These tell gcc to put each function and global variable in a separate section.
The linker can than remove all unreferenced section. But in the olsrd binary
unused doesn't imply unused at all since the function may be used by plugins,
e.g. the ones in src/plugin_utils.c.
So we can use that featuer at most to identify unused functions and remove them
from the source by hand.


Index: Makefile.inc
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** Makefile.inc	29 Nov 2007 23:03:48 -0000	1.47
--- Makefile.inc	6 Dec 2007 20:13:56 -0000	1.48
***************
*** 78,82 ****
  WARNINGS +=	-Wpointer-arith
  WARNINGS +=	-Wcast-qual
! # the following 5 do not work yet
  #WARNINGS +=	-Wshadow
  #WARNINGS +=	-Wpointer-arith
--- 78,82 ----
  WARNINGS +=	-Wpointer-arith
  WARNINGS +=	-Wcast-qual
! # the following 5 do not work yet and need more work on it
  #WARNINGS +=	-Wshadow
  #WARNINGS +=	-Wpointer-arith
***************
*** 100,103 ****
--- 100,111 ----
  # we have small inline functions in src/lq_route.c which should always be inlined
  WARNINGS +=	-finline-limit=50
+ # These tell gcc to put each function and global variable in a separate section.
+ # The linker can than remove all unreferenced section. But in the olsrd binary
+ # unused doesn't imply unused at all since the function may be used by plugins,
+ # e.g. the ones in src/plugin_utils.c.
+ # So we can use that featuer at most to identify unused functions and remove them
+ # from the source by hand.
+ #WARNINGS +=	-ffunction-sections
+ #WARNINGS +=	-fdata-sections
  WARNINGS :=	$(shell CC="$(CC)" $(TOPDIR)/gcc-warnings $(WARNINGS))
  endif
***************
*** 122,125 ****
--- 130,139 ----
  LDFLAGS +=	-Wl,-export-dynamic 
  endif
+ # LDFLAGS for all 
+ LDFLAGS +=	-Wl,--warn-common
+ # See above at "-ffunction-sections" for an explanation (and why it is disabled).
+ #LDOPTS +=	-Wl,--gc-sections
+ #LDOPTS +=	-Wl,--print-gc-sections
+ #LDFLAGS +=	$(shell CC="$(CC)" $(TOPDIR)/ld-warnings $(LDOPTS))
  ifneq ($(MUDFLAP),0)
  LIBS +=		-lmudflapth





More information about the Olsr-cvs mailing list