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]

1997-09-29: Bad name mangling by c++


Hi,

I had to recompile `dxpc-3.7.0' with the new c++.  I had problems w/
inconsistent name mangling.

  c++ -g -O2  -I/opt/X11R6.1/include  -DHAVE_SYS_SELECT_H=1  -o dxpc main.o util.o constants.o Stats.o Multiplexer.o ClientMultiplexer.o ServerMultiplexer.o ClientChannel.o ServerChannel.o ReadBuffer.o ProxyReadBuffer.o ClientReadBuffer.o ServerReadBuffer.o EncodeBuffer.o DecodeBuffer.o WriteBuffer.o IntCache.o CharCache.o PixelCache.o HuffmanCoder.o ClientCache.o ServerCache.o TextCompressor.o LastPixels.o SequenceNumQueue.o BlockCache.o BlockCacheSet.o   -L/opt/X11R6.1/lib -R/opt/X11R6.1/lib -lsocket  -lnsl
  main.o: In function `main':
  /home/grad04/harinath/z/z/dxpc-3.7.0/sol2/../main.C:108: undefined reference to `SaveCopyrightFromOptimizer__Iv'
  collect2: ld returned 1 exit status
  make: *** [dxpc] Error 1

Here's why:

  rawana ~/z/z/dxpc-3.7.0/sol2 > c++ --version
  egcs-2.90.11 970929 (gcc2-970802 experimental)
  rawana ~/z/z/dxpc-3.7.0/sol2 > nm main.o | grep Copy
	   U SaveCopyrightFromOptimizer__Iv
  rawana ~/z/z/dxpc-3.7.0/sol2 > nm constants.o | grep Copy
  00000000 T SaveCopyrightFromOptimizer__

And here's the relevant part of the source code:

  rawana ~/z/z/dxpc-3.7.0 > grep -C SaveCopy *
  constants.C-// "copyright" string literal ends up in the resulting binary
  constants.C-const char *
  constants.C:SaveCopyrightFromOptimizer(void)
  constants.C-{
  constants.C-  return copyright;
  --
  constants.H-// Call this in something other than constants.C to make sure that the
  constants.H-// copyright and liability disclaimer end up in the resulting executable
  constants.H:extern const char *SaveCopyrightFromOptimizer(void);
  constants.H-
  constants.H-#endif /* Constants_H */
  --
  main.C-main(int argc, char **argv)
  main.C-{
  main.C:  (void) SaveCopyrightFromOptimizer();
  main.C-
  main.C-  udomSocketPathname[0] = 0;

If you need more info, I could send you a more detailed script.

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash


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