I am using Xilinx EDK 7.1.2 Build EDK_H.12.5.1+0, targeting the Microblaze. If I define a pure virtual function in a C++ class and declare an object of a derived class in which that function is overridden, linker errors result for "realloc" if Library/OS parameters STDIN and STDOUT are defined as "None", and additionally for "outbyte" and "inbyte" if they are defined as "RS232". A transcript for the latter case follows:
Command xbash -q -c "cd /cygdrive/c/Test/XPS/; /usr/bin/make -f system.make program; exit;" Started...
mb-gcc -O0 C:/Test/src/main.cpp -o Test/executable.elf \
-mno-xl-soft-mul -g -I./microblaze_0/include/ -IC:/Test/src/
-L./microblaze_0/lib/ \
-xl-mode-executable \
-D__cplusplus -Weffc++ -DNDEBUG -lstdc++ /cygdrive/c/EDK/gnu/microblaze/nt/bin/../lib/gcc/microblaze/3.4.1/../../../../microblaze/lib/libstdc++.a(cp-demangle.o): In function `d_print_resize': /cygdrive/y/gnu_builds/halite/env/Jobs/MDT/sw/nt/gnu1/bld_mb_gcc/microblaze/libstdc++-v3/libsupc++/cp-demangle.c(.text+0x23b0): undefined reference to `realloc' ./microblaze_0/lib//libc.a(write.o): In function `write': write.o(.text+0x2c): undefined reference to `outbyte' write.o(.text+0x58): undefined reference to `outbyte' write.o(.text+0x68): undefined reference to `outbyte' ./microblaze_0/lib//libc.a(read.o): In function `read': read.o(.text+0x3c): undefined reference to `inbyte' collect2: ld returned 1 exit status make: *** [Test/executable.elf] Error 1 Done.
If I supply null routines simply to satisfy the linker, I notice an increase of 60K in code size. The virtual function definition is:
virtual void Get_String(char string[]) = 0;
If I simply change the above line to "virtual void Get_String(char string[]) {};", no linker errors result and the program runs as expected.
If I write code in which a (C++) exception is thrown and handled, the same linker errors occur as listed above. The only workaround here is to write a lot of error-handling code.
Despite the references in the error messages, my program does not call any printing routines.