Cannot Debug with Link Time Optimisations On

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Cannot Debug with Link Time Optimisations On

跳至解决方案
2,636 次查看
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 解答
2,269 次查看
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

在原帖中查看解决方案

2 回复数
2,269 次查看
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 项奖励
回复
2,270 次查看
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