Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

-g3 generates incorrect target.ld

I use the following global compiler flags in the nios2configtool "-g3 -O0 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -DSYSTEM_BUS_WIDTH=32 -mno-hw-mul". I changed the default options -g and -O3 to -g3 and O0. According to the gcc documentation -g3 requests debugging information at level 3 (default is 2). The lib compiles fine but there seems to be a problem with the generated linker script target.ld in the lib dir. It now contains a lot of defines as in normal c- source code. The linker cannot handle these defines and exits because of a parse error. If I delete all the defines in target.ld the build succeeds. Is this a bug of the nios2configtool?

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    This is due to the way eCos generates it's linker script, and it effects all architectures (not just Nios II). The linker script is generated using the C pre-processor, and the linker can't cope with the macro debug information that the -g3 option creates. You can use anything up to and including -g2 when building eCos.