AR# 29379


11.1 EDK - GCC 4.1.1 support for MicroBlaze


What are some of the issues when using GCC 4.1.1 for MicroBlaze?


MicroBlaze GDB

When debugging binaries produced by the EDK 9.1i or prior versions of the compiler, Xilinx recommends that you use only the EDK 9.1i or prior versions of the debugger. The EDK 9.2i debugger is not compatible with older binaries.

MicroBlaze Binutils

- The new C++ compiler creates sections with names such as .sdata*.*. Linker scripts generated by BSB and other tools in EDK 8.2i and earlier tools do not have section assignments for such sections and, consequently, do not correctly assign these new sections. You can regenerate your linker scripts with Linker Script Generator, and they will contain the required directives.

- mb-objdump -S does not intermingle source and assembly in the disassembly. You can work around this issue by using one of the following:

-- Invoke mb-objdump from the directory in which the sources are contained.

-- Compile the application using -gstabs. However, this option is not recommended as it could affect debug.

MicroBlaze GCC

- Code Size Increase

As a result of the move to a standard exit and atexit() mechanism, there is a fixed code size increase for all programs that use standard compilation. This code size increase is ~800 bytes. This includes 240 bytes worth of data and ~560 bytes worth of code.

The standard input/output library (STDIO) and malloc library have also grown in size in Newlib 1.14.0. This increase can be up to four kilobytes. This change will affect your programs if you use STDIO or dynamic allocation routines such as getchar (), printf (), malloc (), etc.

- Compiler generates new warnings for built in functions that are used without the appropriate header file included (e.g., memcpy, printf). To eliminate the warning, the appropriate header file must be added to the list of includes. These warnings are in accordance to standards set by FSF GCC.

- Support for generalized lvalues have been removed in GCC-4.1.1 according to the C standard. The following type of code should be changed as follows:


(char *) var = "STRING";


var = (char *) "STRING";

- With the new compiler, you cannot link against old libraries and vice versa. The old binutils had a number of errors in generating relocation records. One of them affected merged sections. In the new compiler, the DWARF string section is a merged section and references to it are becoming garbled and show up as errors. There might be other errors in generating relocs that cause similar problems. Basically, these errors occur when linking code from a new compiler with libraries generated from the old one.

- Cannot use -Ttext, -Tdata, -Tbss switches without specifying a linker script. These switches can be used only when providing a user linker script. A warning or error will be issued by the compiler in SP1.

MicroBlaze Newlib

- atexit () supports registration with a maximum of only 32 exit functions. This is to prevent unnecessary code bloat in programs that do not use atexit(). Also, the C standard requires only 32 exit functions to be supported by atexit ().

AR# 29379
Date 12/15/2012
Status Active
Type General Article
People Also Viewed