This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

arm-none-eabi-gcc: symbols in debug-info do not have address information with new compiler version

Hello all,

previously we were using arm-none-eabi-gcc 7.3.1 to compile an elf-file which was the input of a tool which includes an elf-file parser to record certain variables.

This elf-file parser basically creates a list of all static variables like this:

Fullscreen
1
2
3
GlobalVariableName Address DataType
ObjectName.ClassVariableName Address DataType
...
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

When updating to compiler version 10.3.1 the parsing of the elf-file does not work properly anymore. I did some debugging and saw that already in the debug-info of the generated elf-file the address information (DW_AT_location) of most variables is missing.

When I use "arm-none-eabi-objdump --dwarf Firmware.elf" on a elf-file compiled with version 10.3.1, there is no "DW_AT_location" visible:

Fullscreen
1
2
3
4
5
6
7
8
<1><b3540>: Abbrev Number: 13 (DW_TAG_variable)
<b3541> DW_AT_name : (indirect string, offset: 0x2f0cd): SystemCoreClock
<b3545> DW_AT_decl_file : 4
<b3546> DW_AT_decl_line : 58
<b3547> DW_AT_decl_column : 17
<b3548> DW_AT_type : 0xb3379
<b354c> DW_AT_external : 1
<b354c> DW_AT_declaration : 1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

However the same with version 7.3.1 shows correct address information:

Fullscreen
1
2
3
4
5
6
<1><26ec2>: Abbrev Number: 90 (DW_TAG_variable)
<26ec3> DW_AT_name : (indirect string, offset: 0x165b): SystemCoreClock
<26ec7> DW_AT_decl_file : 120
<26ec8> DW_AT_decl_line : 135
<26ec9> DW_AT_type : 0x4d
<26ecd> DW_AT_location : 5 byte block: 3 68 0 0 20 (DW_OP_addr: 20000068)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

But in the map file of both compiler versions the address is shown correctly in the map file:

Fullscreen
1
2
.data.SystemCoreClock
0x0000000020000000 0x4 /tmp/Firmware.elf.qCCO2z.ltrans0.ltrans.o
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

The compiler settings for 10.3.1 are:

Fullscreen
1
2
3
GNU GIMPLE 10.3.1 20210824 (release)
-mfloat-abi=hard -mfpu=fpv4-sp-d16 -mcpu=cortex-m4 -mthumb -mlittle-endian -mfloat-abi=hard -mfpu=fpv4-sp-d16 -march=armv7e-m+fp
-g -ggdb -Os -Os -fno-openmp -fno-openacc -fno-pie -fcf-protection=none -ffunction-sections -fdata-sections -fltrans
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

- Does anybody have an idea why the address information is missing with the new compiler version?

- Is there an easier way to generate a list of variables (global and class variables) like shown at the beginning of the post?

Thank you in advance!

Regards,

Martin

0