MIPS C++ bug

gp@qnx.com gp@qnx.com
Tue Jun 17 22:32:00 GMT 2003


Hi.

I have encountered an issue with my gcc-3.2.3 mips port.  With the attached
testcase, I am seeing:

  [gp] mips-c++:>make clean;make
  rm -f libsomelib.so *.o someprog
  ntomips-g++ -shared -O2 -c somelib.cpp
  ntomips-g++ -shared -O2 -o libsomelib.so somelib.o
  ntomips-g++ -O2 -c someprog.cpp
  ntomips-g++ -O2 -o someprog -Wl,-R. someprog.o -L. -lsomelib
  ./libsomelib.so: undefined reference to `SomeCls::DEF_INST'
  collect2: ld returned 1 exit status
  make: *** [all] Error 1

It has to do with the .externs and optimization. DEF_INST is a public static
const int in class SomeCls. 

If I use -O0, or if I use -G0, then it works.  It fails with -O1, -O2, and -O3.

Could someone try this and let me know?  I have trimmed it down to a fairly
small testcase.  I don't have a working mips port of anything newer than
3.2.3, using binutils 2.12.1.

Thanks.
GP
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mips++.tgz
Type: application/octet-stream
Size: 513 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20030617/0e9d9075/attachment.obj>


More information about the Gcc mailing list