cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Voyager
Voyager
4,563 Views
Registered: ‎07-28-2008

(gcc linker) mb-gcc switch differences between Release and Debug?

Jump to solution

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,

 

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
Voyager
Voyager
6,280 Views
Registered: ‎07-28-2008

Re: (gcc linker) mb-gcc switch differences between Release and Debug?

Jump to solution

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,

 

 

View solution in original post

0 Kudos
2 Replies
Highlighted
Xilinx Employee
Xilinx Employee
4,557 Views
Registered: ‎08-02-2007

Re: (gcc linker) mb-gcc switch differences between Release and Debug?

Jump to solution

Hi,

 

Refer to this link

 

http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/Optimize-Options.html#Optimize-Options

 

--Hem

 

 

----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
Voyager
Voyager
6,281 Views
Registered: ‎07-28-2008

Re: (gcc linker) mb-gcc switch differences between Release and Debug?

Jump to solution

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,

 

 

View solution in original post

0 Kudos