This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] MSP430-gcc:启用 LTO 时 DWARF 调试信息损坏

Guru**** 657930 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/1217927/msp430-gcc-corrupt-dwarf-debug-info-when-enabling-lto

大家好!

当我为程序启用 LTO 以减小代码大小时、MSP430-gcc 似乎输出损坏的 DWARF 调试信息、这会阻止调试工具工作。 例如、msp430-elf-addr2line 输出:

$ msp430-elf-addr2line -e a.out 00008018
msp430-elf-addr2line:DWARF 错误:无效的抽象实例裸片引用
??:?

我将问题减少到下面的测试用例(有关步骤、请参阅注释)。 有趣的 是、腐败似乎是周期性的、在分配的 constexpr 数据量中、因此我猜 gcc 中有一个 int16_t 溢出。 要在正常 情况和损坏情况之间交换、请包含不同的 xn 范围、例如 x01-x03、x01-x07等

是否有人碰巧知道我应该在 MSP430-gcc 源中的何处开始寻找补丁?

谢谢。
大卫

//测试案例:
// msp430-elf-gcc-9.3.1 -g -flto -std=c++17 test.cpp
// msp430-elf-nm a.out | grep ' main'
// msp430-elf-addr2line -e a.out 

结构 A
{
Static constexpr char x01[8192]={};//确定
Static constexpr char x02[8192]={};//确定
Static constexpr char x03[8192]={};//确定
static constexpr char x04[8192]={};//中断
static constexpr char x05[8192]={};//中断
static constexpr char x06[8192]={};//中断
static constexpr char x07[8192]={};//中断
Static constexpr char x08[8192]={};//确定
Static constexpr char x09[8192]={};//确定
Static constexpr char x10[8192]={};//确定
Static constexpr char x11[8192]={};//确定
static constexpr char x12[8192]={};//中断
static constexpr char x13[8192]={};//中断
static constexpr char x14[8192]={};//中断
static constexpr char x15[8192]={};//中断
Static constexpr char x16[8192]={};//确定
Static constexpr char X17[8192]={};//确定
Static constexpr char x18[8192]={};//确定
Static constexpr char x19[8192]={};//确定
static constexpr char x20[8192]={};//中断
static constexpr char x21[8192]={};//中断
static constexpr char x22[8192]={};//中断
static constexpr char x23[8192]={};// break
};

int main(){
用于(;););
}