Page MenuHomePhabricator

[BinaryFormat] Teach identify_magic about Tapi files.
ClosedPublic

Authored by cishida on Aug 13 2019, 9:50 AM.

Details

Summary

Tapi files are YAML files that start with the !tapi tag. The only execption are
TBD v1 files, which don't have a tag. In that case we have to scan a little
further and check if the first key "archs" exists.

This is the first patch in a series of patches to add libObject support for
text-based dynamic library (.tbd) files.

This patch is practically exactly the same as D37820, that was never pushed to master,
and is needed for future commits related to reading tbd files for llvm-nm

Diff Detail

Repository
rL LLVM

Event Timeline

cishida created this revision.Aug 13 2019, 9:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2019, 9:50 AM
steven_wu accepted this revision.Aug 13 2019, 1:37 PM

few small comments. Otherwise, LGTM.

llvm/include/llvm/BinaryFormat/Magic.h
52 ↗(On Diff #214861)

tapi_file is not very clear what it actually refer to. Maybe something like tapi_dylib_stub (I am not very happy with this as well)?

llvm/lib/BinaryFormat/Magic.cpp
214 ↗(On Diff #214861)

maybe reverse the order of the condition?

This revision is now accepted and ready to land.Aug 13 2019, 1:37 PM
cishida marked an inline comment as done.Aug 13 2019, 4:27 PM
cishida added inline comments.
llvm/include/llvm/BinaryFormat/Magic.h
52 ↗(On Diff #214861)

what about tbd_file? or tapi_tbd_file? that way it can be deduced that tbd is short for the comment provided and would match the file extension?

ributzka added inline comments.Aug 13 2019, 5:17 PM
llvm/include/llvm/BinaryFormat/Magic.h
52 ↗(On Diff #214861)

I didn't use TBD file on purpose, because that is the current file extension. The file type is tapi and there might be other tapi files in the future that will have different file extensions.

ributzka added inline comments.Aug 13 2019, 5:18 PM
llvm/lib/BinaryFormat/Magic.cpp
214 ↗(On Diff #214861)

+1

cishida updated this revision to Diff 215158.Aug 14 2019, 10:07 AM

Reverse order of conditional for file_magic

cishida updated this revision to Diff 215174.Aug 14 2019, 11:08 AM
  • Reverse order of conditional for file_magic
Herald added a reviewer: martong. · View Herald Transcript
Herald added a reviewer: jfb. · View Herald Transcript
Herald added a reviewer: shafik. · View Herald Transcript
Herald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald Transcript
cishida abandoned this revision.Aug 14 2019, 11:10 AM
This comment was removed by cishida.
cishida removed projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project.
cishida removed subscribers: rnkovacs, wuzish, srhines and 35 others.
Herald added a reviewer: jfb. · View Herald Transcript
Herald added a reviewer: shafik. · View Herald Transcript
Herald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald Transcript
cishida updated this revision to Diff 215181.Aug 14 2019, 11:34 AM

Reverse order of conditional for file_magic

This revision is now accepted and ready to land.Aug 14 2019, 11:34 AM
This revision was automatically updated to reflect the committed changes.