05-09-2014 08:57 AM - edited 05-09-2014 09:01 AM
I have an obvious error (undefined Macro) in bsp code, but executable builds well for debug. Because the function is never used, and mb-gcc somehow managed to figure it out.
And I don't find bsp has build specific flags, and I've checked build log, there is no difference between Release and Debug for bsp build.
Build .elf for release. Linker fails and complains "undefined reference to ..." at linking:
[release linker] mb-gcc -Wl,-T -Wl,../src/lscript.ld -L../../hello_bsp/microblaze_0/lib -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mcpu=v8.50.b -mno-xl-soft-mul -o "hello.elf" ./src/helloworld.o ./src/platform.o -Wl,--start-group,-lxil,-lgcc,-lc,--end-group [debug linker] mb-gcc -Wl,-T -Wl,../src/lscript.ld -L../../hello_bsp/microblaze_0/lib -mlittle-endian -mxl-barrel-shift -mxl-pattern-compare -mcpu=v8.50.b -mno-xl-soft-mul -Wl,--no-relax -Wl,--gc-sections -o "hello.elf" ./src/helloworld.o ./src/platform.o -Wl,--start-group,-lxil,-lgcc,-lc,--end-group
Notice the difference is only "--no-relax", and "--gc-sections",
In Building stages: there is "--no-relax -ffunction-sections -fdata-sections" for debug build only.
could not find any documentation on these swtiches. And I have double checked *.ld, they are identical. Can someone share you knowledge about this mistery for me?
Thanks,
05-09-2014 11:02 AM - edited 05-09-2014 11:21 AM
Thanks for your reference link, now I have better understanding about these flags. And see the reason why it's not turned on for Release build by default.
Double checked in Release build settings, flag name "Enable garbage collecor" is much more meanful. MicroBlaze gcc linker::General::Enable garbage collector (-Wl,--gc-sections). I guess Xilinx has strong reasons for not having it turned on for Release build as well.
Still don't find expalnation about "No relaxation (-Wl,--no-relax)".
Thanks, again,
05-09-2014 10:22 AM
Hi,
Refer to this link
http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Optimize-Options.html#Optimize-Options
--Hem
05-09-2014 11:02 AM - edited 05-09-2014 11:21 AM
Thanks for your reference link, now I have better understanding about these flags. And see the reason why it's not turned on for Release build by default.
Double checked in Release build settings, flag name "Enable garbage collecor" is much more meanful. MicroBlaze gcc linker::General::Enable garbage collector (-Wl,--gc-sections). I guess Xilinx has strong reasons for not having it turned on for Release build as well.
Still don't find expalnation about "No relaxation (-Wl,--no-relax)".
Thanks, again,