[PATCH] D91505: ELFAsmParser: Remove non-SHF_ALLOC or non-executable sections' line info/address ranges contribution for -g
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 16 16:49:01 PST 2020
MaskRay updated this revision to Diff 305627.
MaskRay marked an inline comment as done.
MaskRay added a comment.
Pre-commit improvement to the test file
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91505/new/
https://reviews.llvm.org/D91505
Files:
llvm/lib/MC/MCParser/ELFAsmParser.cpp
llvm/test/MC/ARM/dwarf-asm-multiple-sections.s
Index: llvm/test/MC/ARM/dwarf-asm-multiple-sections.s
===================================================================
--- llvm/test/MC/ARM/dwarf-asm-multiple-sections.s
+++ llvm/test/MC/ARM/dwarf-asm-multiple-sections.s
@@ -20,6 +20,16 @@
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
Index: llvm/lib/MC/MCParser/ELFAsmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -659,7 +659,9 @@
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91505.305627.patch
Type: text/x-patch
Size: 1300 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201117/4bf2e500/attachment.bin>
More information about the llvm-commits
mailing list