UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 22159

7.1i SP2 - EDK/GNU-/..../demangle.c(.text+0x23b0): undefined reference to `realloc'

描述

Keywords: realloc, link, C++, MicroBlaze

Urgency: Standard

General Description:
When I try to compile a c++ application with the MicroBlaze compiler, I receive linker errors (unresolved symbols), not traceable to my source code. It makes no difference whether I run the compiler/linker from within the EDK, or from within the Xygwin shell.

Error Message:
---------------------------------------
mb-gcc -O2 test/*.cpp -o test/executable.elf \
-mno-xl-soft-mul -mno-xl-soft-div -mhard-float -Wl,-T -Wl,test_linker_script -g -I./microblaze_0/include/ -Itest/ -L./microblaze_0/lib/ \
-xl-mode-executable \
-lstdc++

/cygdrive/c/cae/Xilinx/Edk7.1/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(malloc.o): In function `malloc':
malloc.o(.text+0x8): relocation truncated to fit: R_MICROBLAZE_SRW32 .sdata
malloc.o(.text+0x20): relocation truncated to fit: R_MICROBLAZE_SRW32 .sdata
collect2: ld returned 1 exit status
make: *** [test/executable.elf] Error 1

解决方案

Create a file called "realloc.c" with the following contents:

#include <stdlib.h>
void *realloc (void *ptr, size_t size)
{
return NULL;
}

Include "realloc.c" as a part of your sources. It is just a dummy implementation and should get rid of the compile issue.

The issue will be resolved in the future major release of the software.
AR# 22159
日期 04/16/2007
状态 Archive
Type 综合文章
的页面