Make the assembler diagnostic emit quoted section names and refer to
the expected flag bits by input character flag.
Details
- Reviewers
MaskRay sidneym • espindola
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
llvm/lib/MC/MCParser/ELFAsmParser.cpp | ||
---|---|---|
646 | 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. | |
650 | A backquote (binutils uses it sometimes) is actually uncommon in LLVM diagnostics. Both unquoted and '-quoted section names are common. |
Added a getSectionFlagString() function.
Changed section name delimiters in diagnostic to single-quotes
llvm/test/MC/ELF/section-flags-changed.s | ||
---|---|---|
6 | When I ran this test, it failed. I'm not quite clear on why FileCheck doesn't match here, I'm sure I'm missing something simple. I'll continue to investigate why this test fails. |
Fixed the expressions in getSectionFlagString() - strings instead of chars, the nulls were the wrong choice.
Test passes now.
llvm/lib/MC/MCParser/ELFAsmParser.cpp | ||
---|---|---|
290 | It is incorrect to mix OS/processor specific flags here. Hard coding generic flags and their strings are also error-prone. I left this as a TODO because it is not very easy to reuse lib/MC/MCSectionELF.cpp#L53 code. I'll check more carefully how to reuse. |
llvm/lib/MC/MCParser/ELFAsmParser.cpp | ||
---|---|---|
290 |
What If I just abstracted the portion of code in PrintSwitchToSection() relating to the flags to a method that takes unsigned Flags and returns the text as a string? That could be used here in ELFAsmParser but also in PrintSwitchToSection()? |
It is incorrect to mix OS/processor specific flags here. Hard coding generic flags and their strings are also error-prone. I left this as a TODO because it is not very easy to reuse lib/MC/MCSectionELF.cpp#L53 code. I'll check more carefully how to reuse.