[PATCH] D114717: [MC][ELF] Fix accepting abbreviated form with Type change
Hafiz Abid Qadeer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 30 06:47:00 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc01c62c76c60: [MC][ELF] Fix accepting abbreviated form with Type change (authored by burnus, committed by abidh).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114717/new/
https://reviews.llvm.org/D114717
Files:
llvm/lib/MC/MCParser/ELFAsmParser.cpp
llvm/test/MC/ELF/section-omitted-attributes.s
Index: llvm/test/MC/ELF/section-omitted-attributes.s
===================================================================
--- llvm/test/MC/ELF/section-omitted-attributes.s
+++ llvm/test/MC/ELF/section-omitted-attributes.s
@@ -4,6 +4,7 @@
# CHECK: .section .foo,"aM", at progbits,1
# CHECK: .section .rodata.cst8,"aM", at progbits,8
+# CHECK: .section .lds_bss,"w", at nobits
.section .foo,"aM", at progbits,1
@@ -15,3 +16,7 @@
.section .rodata.cst8,"aM", at progbits,8
.section .rodata.cst8
+
+# Likewise for Type changes
+.section .lds_bss,"w", at nobits
+.section .lds_bss
Index: llvm/lib/MC/MCParser/ELFAsmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -676,14 +676,14 @@
getContext().getELFSection(SectionName, Type, Flags, Size, GroupName,
IsComdat, UniqueID, LinkedToSym);
getStreamer().SwitchSection(Section, Subsection);
- if (Section->getType() != Type &&
+ // Check that flags are used consistently. However, the GNU assembler permits
+ // to leave out in subsequent uses of the same sections; for compatibility,
+ // do likewise.
+ if (!TypeName.empty() && Section->getType() != Type &&
!allowSectionTypeMismatch(getContext().getTargetTriple(), SectionName,
Type))
Error(loc, "changed section type for " + SectionName + ", expected: 0x" +
utohexstr(Section->getType()));
- // Check that flags are used consistently. However, the GNU assembler permits
- // to leave out in subsequent uses of the same sections; for compatibility,
- // do likewise.
if ((extraFlags || Size || !TypeName.empty()) && Section->getFlags() != Flags)
Error(loc, "changed section flags for " + SectionName + ", expected: 0x" +
utohexstr(Section->getFlags()));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114717.390699.patch
Type: text/x-patch
Size: 1938 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211130/ac48fa00/attachment.bin>
More information about the llvm-commits
mailing list