Page MenuHomePhabricator

[BinaryFormat] Teach identify_magic about Tapi files.
AcceptedPublic

Authored by cishida on Tue, Aug 13, 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

Event Timeline

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

few small comments. Otherwise, LGTM.

llvm/include/llvm/BinaryFormat/Magic.h
52

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

maybe reverse the order of the condition?

This revision is now accepted and ready to land.Tue, Aug 13, 1:37 PM
cishida marked an inline comment as done.Tue, Aug 13, 4:27 PM
cishida added inline comments.
llvm/include/llvm/BinaryFormat/Magic.h
52

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.Tue, Aug 13, 5:17 PM
llvm/include/llvm/BinaryFormat/Magic.h
52

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.Tue, Aug 13, 5:18 PM
llvm/lib/BinaryFormat/Magic.cpp
214

+1

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

Reverse order of conditional for file_magic

cishida updated this revision to Diff 215174.Wed, Aug 14, 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.Wed, Aug 14, 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.Wed, Aug 14, 11:34 AM

Reverse order of conditional for file_magic

This revision is now accepted and ready to land.Wed, Aug 14, 11:34 AM