View Single Post
  #8   (View Single Post)  
Old 6th May 2013
thirdm thirdm is offline
Spam Deminer
 
Join Date: May 2009
Posts: 248
Default

Thanks for experimenting for me. That's an interesting clue. According to make's man page, the env variable MAKEFLAGS (and the make variables .MAKEFLAGS and MFLAGS) is set to include anything passed as command line arguments.

But how to apply this knowledge to understand what I might have done to temporarily lose the bug? I still have the binaries so can compare them with readelf:

normal cwm image with no debugging
<hr>
Size: 68K
Entry point address: 0x1802110
Start of section headers: 68416 (bytes into file)
Number of section headers: 30
Section header string table index: 29

cwm image with bug "disappeared" by mucking with CFLAGS and STRIP in unknown way.
<hr>
Size: 92K
Entry point address: 0x18021a0
Start of section headers: 92448 (bytes into file)
Number of section headers: 30
Section header string table index: 29
Symbol table '.dynsym' contains 170 entries:
Extra .dynsym symbols: tolower, ispunct, isspace, bzero

cwm image from make DEBUG=-g (shows problem and has debugging info)
<hr>
Size: 288K
Entry point address: 0x1802110
Start of section headers: 250252 (bytes into file)
Number of section headers: 41
Section header string table index: 38

I know what I did for sure now because I can reproduce this. I set
CFLAGS=-g and STRIP= (nothing) using export. Then I did make clean, make, and make install in the cwm directory.

It would appear that what I did was to turn off optimization. I guess those extra symbols were
things that gcc was able to throw away somehow, perhaps by inlining internal definitions. Another difference doing things the right way is that -g also gets passed to the linking call to gcc (it doesn't setting CFLAGS in the environment -- perhaps your MAKEFLAGS point comes into play here). Not sure what effect that has, if any.

Code:
# make -p | grep CFLAGS
CFLAGS           = -O2 ${PIPE} ${DEBUG} -Wall ${COPTS} $(COPTS)
COMPILE.c        = ${CC} ${CFLAGS} ${CPPFLAGS} -c
CONFIGURE_ENV    = PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)"  CONFIG_SITE=$(CONFIG_SITE)  CFLAGS="$(CFLAGS:C/ *$//)"  MAKE="${MAKE}"
CXXFLAGS         = ${CFLAGS} ${CXXOPTS}
LINK.c           = ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
        @files="${.ALLSRC:M*.s} ${.ALLSRC:M*.S}";  if [ "$$files" != " " ]; then  echo mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${CPPFLAGS} ${AINC} $$files; mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${CPPFLAGS} ${AINC} $$files;  fi
        @files="${.ALLSRC:M*.c}";  if [ "$$files" != "" ]; then  echo mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${CPPFLAGS} $$files;  mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${CPPFLAGS} $$files;  fi
# make DEBUG=-g -p | grep CFLAGS
CFLAGS           = -O2 ${PIPE} ${DEBUG} -Wall ${COPTS} $(COPTS)
COMPILE.c        = ${CC} ${CFLAGS} ${CPPFLAGS} -c
CONFIGURE_ENV    = PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)"  CONFIG_SITE=$(CONFIG_SITE)  CFLAGS="$(CFLAGS:C/ *$//)"  MAKE="${MAKE}"
CXXFLAGS         = ${CFLAGS} ${CXXOPTS}
LINK.c           = ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
        @files="${.ALLSRC:M*.s} ${.ALLSRC:M*.S}";  if [ "$$files" != " " ]; then  echo mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${CPPFLAGS} ${AINC} $$files; mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${CPPFLAGS} ${AINC} $$files;  fi
        @files="${.ALLSRC:M*.c}";  if [ "$$files" != "" ]; then  echo mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${CPPFLAGS} $$files;  mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${CPPFLAGS} $$files;  fi
# env CFLAGS=-g make -p | grep CFLAGS
COMPILE.c        = ${CC} ${CFLAGS} ${CPPFLAGS} -c
CONFIGURE_ENV    = PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)"  CONFIG_SITE=$(CONFIG_SITE)  CFLAGS="$(CFLAGS:C/ *$//)"  MAKE="${MAKE}"
CXXFLAGS         = ${CFLAGS} ${CXXOPTS}
LINK.c           = ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CFLAGS           = -g -Wall ${COPTS} $(COPTS)
        @files="${.ALLSRC:M*.s} ${.ALLSRC:M*.S}";  if [ "$$files" != " " ]; then  echo mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${CPPFLAGS} ${AINC} $$files; mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${CPPFLAGS} ${AINC} $$files;  fi
        @files="${.ALLSRC:M*.c}";  if [ "$$files" != "" ]; then  echo mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${CPPFLAGS} $$files;  mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${CPPFLAGS} $$files;  fi
Reply With Quote