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 215334 llvm/trunk/test/MC/MachO/ARM/darwin-ARM-reloc.s
llvm/trunk/test/MC/MachO/ARM/darwin-Thumb-reloc.s
llvm/trunk/test/MC/MachO/ARM/relax-thumb-ldr-literal.s
llvm/trunk/test/MC/MachO/absolute.s
llvm/trunk/test/MC/MachO/absolutize.s
llvm/trunk/test/MC/MachO/comm-1.s
llvm/trunk/test/MC/MachO/darwin-complex-difference.s
llvm/trunk/test/MC/MachO/darwin-x86_64-diff-relocs.s
llvm/trunk/test/MC/MachO/darwin-x86_64-nobase-relocs.s
llvm/trunk/test/MC/MachO/darwin-x86_64-reloc-offsets.s
llvm/trunk/test/MC/MachO/data.s
llvm/trunk/test/MC/MachO/debug_frame.s
llvm/trunk/test/MC/MachO/diff-with-two-sections.s
llvm/trunk/test/MC/MachO/direction_labels.s
llvm/trunk/test/MC/MachO/file.s
llvm/trunk/test/MC/MachO/indirect-symbols.s
llvm/trunk/test/MC/MachO/jcc.s
llvm/trunk/test/MC/MachO/lcomm-attributes.s
llvm/trunk/test/MC/MachO/loc.s
llvm/trunk/test/MC/MachO/pcrel-to-other-section.s
llvm/trunk/test/MC/MachO/relax-recompute-align.s
llvm/trunk/test/MC/MachO/reloc-pcrel-offset.s
llvm/trunk/test/MC/MachO/section-align-1.s
llvm/trunk/test/MC/MachO/section-align-2.s
llvm/trunk/test/MC/MachO/section-flags.s
llvm/trunk/test/MC/MachO/string-table.s
llvm/trunk/test/MC/MachO/symbol-diff.s
llvm/trunk/test/MC/MachO/symbol-flags.s
llvm/trunk/test/MC/MachO/symbol-indirect.s
llvm/trunk/test/MC/MachO/symbols-1.s
llvm/trunk/test/MC/MachO/tbss.s
llvm/trunk/test/MC/MachO/tdata.s
llvm/trunk/test/MC/MachO/thread_init_func.s
llvm/trunk/test/MC/MachO/tls.s
llvm/trunk/test/MC/MachO/tlv-reloc.s
llvm/trunk/test/MC/MachO/tlv.s
llvm/trunk/test/MC/MachO/values.s
llvm/trunk/test/MC/MachO/variable-exprs.s
llvm/trunk/test/MC/MachO/weakdef.s
llvm/trunk/test/MC/MachO/x86_32-optimal_nop.s
llvm/trunk/test/MC/MachO/x86_32-sections.s
llvm/trunk/test/MC/MachO/x86_32-symbols.s
llvm/trunk/test/MC/MachO/x86_64-sections.s
llvm/trunk/test/MC/MachO/zero-space.s
llvm/trunk/test/MC/MachO/zerofill-1.s
llvm/trunk/test/MC/MachO/zerofill-2.s
llvm/trunk/test/MC/MachO/zerofill-3.s
llvm/trunk/test/MC/MachO/zerofill-5.s
llvm/trunk/test/MC/X86/cfi_def_cfa-crash.s
llvm/trunk/test/tools/dsymutil/X86/dsym-companion.test
llvm/trunk/test/tools/llvm-readobj/macho-sections.test
llvm/trunk/test/tools/llvm-readobj/macho-universal-x86_64.i386.test
llvm/trunk/test/tools/llvm-readobj/sections-ext.test
llvm/trunk/test/tools/llvm-readobj/sections.test
llvm/trunk/tools/llvm-readobj/MachODumper.cpp
|