This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

--nostdlib details?


Hello,
    In tracking down a compile problem with kdebase 2.2.0 on
debian ppc I discovered an oddity with gcc/libtool that I
need a clarification on. One of the shared libs used by
kcontrol to display control panels gets an undefined
symbol for __cmpdi2 from one of its object files (memory.o).
This situation seems to arise because the following libtool
command...

/bin/sh ../../libtool --mode=link --tag=CXX g++  -DNDEBUG -O2 -fno-exceptions -fno-check-new -DQT_CLEAN_NAMESPACE -DQT_NO_COMPAT -DQT_NO_ASCII_CAST   -o libkcm_info.la -rpath /usr/lib/kde2 -L/usr/X11R6/lib -L/usr/lib  -module -avoid-version -no-undefined main.lo memory.lo libkcm_info_la_meta_unload.lo   -lkdeui

generates the following command for g++...

g++ -shared -nostdlib /usr/lib/crti.o /usr/lib/gcc-lib/powerpc-linux/2.95.4/crtbeginS.o  .libs/main.o .libs/memory.o .libs/libkcm_info_la_meta_unload.o  -L/usr/X11R6/lib -L/usr/lib  /usr/lib/libkdeui.so -L/usr/lib/gcc-lib/powerpc-linux/2.95.4 -lstdc++ -lm -lc /usr/lib/gcc-lib/powerpc-linux/2.95.4/crtendS.o /usr/lib/crtn.o  -Wl,-soname -Wl,libkcm_info.so -o .libs/libkcm_info.so

I have been told that gcc should always link against -lgcc however that
doesn't seem to be the case here since the __cmpdi2 symbol remains undefined
unless I add -lgcc to the libtool parameters so that it appears in the 
generated g++ call.
      My question is how much exactly does -nostdlib stop from linking?
The gcc man page says...

-nostdlib
              Don't use the standard system libraries and startup
              files  when  linking.   Only  the files you specify
              will be passed to the linker.

Does this exclusion of standard system libraries extend to -lgcc?
Is this possibly a bug in gcc 2.95.4? Also if it does exclude
libgcc should libtool be always adding -lgcc whenever it uses
-nostdlib with a compiler? Thanks in advance for any comments.
                         Jack Howarth
------------------------------------------------------------------------------
Jack W. Howarth, Ph.D.                                    231 Albert Sabin Way
NMR Facility Director                              Cincinnati, Ohio 45267-0524
Dept. of Molecular Genetics                              phone: (513) 558-4420
Univ. of Cincinnati College of Medicine                    fax: (513) 558-8474


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]