[PATCH] D77919: [MC][ELF] Add section flags to diagnostic

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 10 17:15:11 PDT 2020


MaskRay added inline comments.


================
Comment at: llvm/lib/MC/MCParser/ELFAsmParser.cpp:646
+    const std::string ExpectedFlagsText =
+        Twine(StringRef((ExpectedFlags & ELF::SHF_ALLOC) ? "a" : "") +
+              StringRef((ExpectedFlags & ELF::SHF_WRITE) ? "w" : "") +
----------------
There are actually a lot more section flags, e.g. SHF_MERGE ('M') SHF_LINK_ORDER ('o') SHF_EXCLUDE ('e'). This patch will leave an empty string for an unknown flag.


================
Comment at: llvm/lib/MC/MCParser/ELFAsmParser.cpp:650
+            .str();
+    Error(loc, "changed section flags for `" + SectionName + "', expected: \"" +
+                   ExpectedFlagsText + "\"");
----------------
A backquote (binutils uses it sometimes) is actually uncommon in LLVM diagnostics. Both unquoted and `'`-quoted section names are common.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77919/new/

https://reviews.llvm.org/D77919





More information about the llvm-commits mailing list