https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103698
Bug ID: 103698 Summary: [12 regression] Code assigned to __attribute__((section(".data"))) generates invalid dwarf: leb128 operand is an undefined symbol Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org Target Milestone: --- Target: arm-none-eabi Created attachment 51990 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51990&action=edit bug.c.orig One-liner extracted from axoloti-1.0.12: $ cat bug.c __attribute__((section(".data"))) int flash_Erase_sector1(int sector) {} gcc-10/binutils-2.35 used to somewhat work. gcc-12/binutils-2.37 gets confused with dwarf data: $ arm-none-eabi-gcc-10.3.0 -mcpu=cortex-m4 -O2 -ggdb -c bug.c -o bug.o /tmp/ccMDYjLi.s: Assembler messages: /tmp/ccMDYjLi.s:15: Warning: ignoring changed section attributes for .data $ arm-none-eabi-gcc-12.0.0 -mcpu=cortex-m4 -O2 -ggdb -c bug.c -o bug.o /tmp/ccBo2IfJ.s: Assembler messages: /tmp/ccBo2IfJ.s:18: Warning: ignoring changed section attributes for .data /tmp/ccBo2IfJ.s:29: Warning: dwarf line number information for .data ignored /tmp/ccBo2IfJ.s:34: Warning: dwarf line number information for .data ignored /tmp/ccBo2IfJ.s:36: Warning: dwarf line number information for .data ignored /tmp/ccBo2IfJ.s:174: Error: leb128 operand is an undefined symbol: .LVU2 /tmp/ccBo2IfJ.s:175: Error: leb128 operand is an undefined symbol: .LVU2 Also attached bug.c.orig before reduction to get the idea what was original code's intent. $ LANG=C ./12/arm-none-eabi-gcc -v Using built-in specs. COLLECT_GCC=/nix/store/396wib4x58qxz0i91ggwhwjx1w63rrh4-arm-none-eabi-stage-final-gcc-debug-12.0.0/bin/arm-none-eabi-gcc COLLECT_LTO_WRAPPER=/nix/store/396wib4x58qxz0i91ggwhwjx1w63rrh4-arm-none-eabi-stage-final-gcc-debug-12.0.0/libexec/gcc/arm-none-eabi/12.0.0/lto-wrapper Target: arm-none-eabi Configured with: Thread model: single Supported LTO compression algorithms: zlib gcc version 12.0.0 20211212 (experimental) (GCC) Is it reasonable to expect it to work? Or `.data` is too speacial to expect code there for dwarf?