Cannot Debug with Link Time Optimisations On

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cannot Debug with Link Time Optimisations On

Jump to solution
1,276 Views
peterb2
Contributor III

When turning on the link time optimisations (the -flto compile option), the debug info in the elf file is being removed for all but the .S files.  If you look at the .map file you can also see that it is not listed.  Is this a consequence of having this level of optimisations on or is it a bug?

Target Info

* MPC5777C

* Using S32DS V1.2 for Power PC

* Also compiling with max optimizations on, the -O3 switch

* debug compile options are -g3 -gdwarf-4

If you have any questions please let me know.

1 Solution
909 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

I found some explanation at Stackoverflow website. It seems it is not possible to combine -flto with -g parameter. Please check the link below:

gcc LTO appears to strip debugging symbols - Stack Overflow 

Regards,

Martin

View solution in original post

2 Replies
909 Views
peterb2
Contributor III

To add some clarification, I mean that when I compile with the -flto option, all .c and .cpp files are missing from the debug info section in the elf file but when I remove the -flto option all those files have debug info.

0 Kudos
910 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

I found some explanation at Stackoverflow website. It seems it is not possible to combine -flto with -g parameter. Please check the link below:

gcc LTO appears to strip debugging symbols - Stack Overflow 

Regards,

Martin