I filed the issue https://sourceware.org/bugzilla/show_bug.cgi?id=26850 ,
which was acknowledged and fixed in GNU binutils 2.36
This patch adds the similar behavior to MC.
Reviewed By: #debug-info, dblaikie
Differential Revision: https://reviews.llvm.org/D91505
Error(loc, "changed section entsize for " + SectionName +
", expected: " + Twine(Section->getEntrySize()));
- if (getContext().getGenDwarfForAssembly()) {
+ if (getContext().getGenDwarfForAssembly() &&
+ (Section->getFlags() & ELF::SHF_ALLOC) &&
+ (Section->getFlags() & ELF::SHF_EXECINSTR)) {
bool InsertResult = getContext().addGenDwarfSection(Section);
if (InsertResult) {
if (getContext().getDwarfVersion() <= 2)
b:
mov r1, r1
+// Non-executable sections do not contribute address ranges.
+ .section .rodata, "a"
+c:
+ mov r2, r2
+
+// Non-SHF_ALLOC sections do not contribute address ranges.
+ .section nonalloc, "x"
+d:
+ mov r3, r3
+
// DWARF: .debug_abbrev contents:
// DWARF: Abbrev table for offset: 0x00000000
// DWARF: [1] DW_TAG_compile_unit DW_CHILDREN_yes