Currently, llvm-readobj mistakenly decodes section type as section attribute.
This patch fixes the bug and affected tests.
Paths
| Differential D66075
[llvm-readobj][MachO] Fix section type printing ClosedPublic Authored by seiya on Aug 12 2019, 1:59 AM.
Details Summary Currently, llvm-readobj mistakenly decodes section type as section attribute. This patch fixes the bug and affected tests.
Diff Detail Event TimelineComment Actions The change looks fine to me, although I wasn't able to quickly find the list of section types anywhere to check against. Could you provide me some documentation? Also, are there test cases for each of the different permitted types? Comment Actions
This was already committed to LLVM years ago in rL178679 (+echristo, the committer), but mistakenly removed in rL235863 due to being an unused variable, instead of the right fix, which is clearly the Attributes->Types typo fixed here Still, I can't find a reference for the original list, it would be good to cite one.
+1, would be nice to have a test in llvm-readobj that enumerates all section types in a yaml2obj case (otherwise, LGTM) Comment Actions The list looks about right from what I recall - we should get a link to where they're documented, but the Apple documentation site moves a bit more than I'd like so this might be the best we can do for now. This revision is now accepted and ready to land.Aug 12 2019, 2:43 PM Comment Actions Thank you for pointing out the related commits, @rupprecht!
A list of section types in mach-o/loader.h (in Apple's binary utilities) or llvm/Binary/Format/MachO.h might be helpful.
It looks few of them are not used in these tests. I'll add a new testcase. Comment Actions Add llvm/test/tools/llvm-readobj/macho-sections.test, which exhaustively tests all section types.
seiya marked 3 inline comments as done. Comment Actions
Closed by commit rL368974: [llvm-readobj][MachO] Fix section type printing (authored by seiya). · Explain WhyAug 15 2019, 12:21 AM This revision was automatically updated to reflect the committed changes. seiya marked an inline comment as done.
Revision Contents
Diff 214759 llvm/test/MC/MachO/ARM/darwin-ARM-reloc.s
llvm/test/MC/MachO/ARM/darwin-Thumb-reloc.s
llvm/test/MC/MachO/ARM/relax-thumb-ldr-literal.s
llvm/test/MC/MachO/absolute.s
llvm/test/MC/MachO/absolutize.s
llvm/test/MC/MachO/comm-1.s
llvm/test/MC/MachO/darwin-complex-difference.s
llvm/test/MC/MachO/darwin-x86_64-diff-relocs.s
llvm/test/MC/MachO/darwin-x86_64-nobase-relocs.s
llvm/test/MC/MachO/darwin-x86_64-reloc-offsets.s
llvm/test/MC/MachO/data.s
llvm/test/MC/MachO/debug_frame.s
llvm/test/MC/MachO/diff-with-two-sections.s
llvm/test/MC/MachO/direction_labels.s
llvm/test/MC/MachO/file.s
llvm/test/MC/MachO/indirect-symbols.s
llvm/test/MC/MachO/jcc.s
llvm/test/MC/MachO/lcomm-attributes.s
llvm/test/MC/MachO/loc.s
llvm/test/MC/MachO/pcrel-to-other-section.s
llvm/test/MC/MachO/relax-recompute-align.s
llvm/test/MC/MachO/reloc-pcrel-offset.s
llvm/test/MC/MachO/section-align-1.s
llvm/test/MC/MachO/section-align-2.s
llvm/test/MC/MachO/section-flags.s
llvm/test/MC/MachO/string-table.s
llvm/test/MC/MachO/symbol-diff.s
llvm/test/MC/MachO/symbol-flags.s
llvm/test/MC/MachO/symbol-indirect.s
llvm/test/MC/MachO/symbols-1.s
llvm/test/MC/MachO/tbss.s
llvm/test/MC/MachO/tdata.s
llvm/test/MC/MachO/thread_init_func.s
llvm/test/MC/MachO/tls.s
llvm/test/MC/MachO/tlv-reloc.s
llvm/test/MC/MachO/tlv.s
llvm/test/MC/MachO/values.s
llvm/test/MC/MachO/variable-exprs.s
llvm/test/MC/MachO/weakdef.s
llvm/test/MC/MachO/x86_32-optimal_nop.s
llvm/test/MC/MachO/x86_32-sections.s
llvm/test/MC/MachO/x86_32-symbols.s
llvm/test/MC/MachO/x86_64-sections.s
llvm/test/MC/MachO/zero-space.s
llvm/test/MC/MachO/zerofill-1.s
llvm/test/MC/MachO/zerofill-2.s
llvm/test/MC/MachO/zerofill-3.s
llvm/test/MC/MachO/zerofill-5.s
llvm/test/MC/X86/cfi_def_cfa-crash.s
llvm/test/tools/dsymutil/X86/dsym-companion.test
llvm/test/tools/llvm-readobj/macho-sections.test
llvm/test/tools/llvm-readobj/macho-universal-x86_64.i386.test
llvm/test/tools/llvm-readobj/sections-ext.test
llvm/test/tools/llvm-readobj/sections.test
llvm/tools/llvm-readobj/MachODumper.cpp
|
Are all fields required, or can some be omitted? Same goes throughout the YAML.