This is an archive of the discontinued LLVM Phabricator instance.

[MachO] Allow the LC_IDENT load command
ClosedPublic

Authored by vsk on Nov 10 2020, 5:03 PM.

Details

Summary

xnu coredumps include an LC_IDENT load command. It's helpful to be able
to just ignore these. IIUC an interested client can grab the identifier
using the MachOObjectFile::load_commands() API.

The status quo is that llvm bails out when it finds an LC_IDENT because
the command is obsolete (see isLoadCommandObsolete).

Diff Detail

Event Timeline

vsk created this revision.Nov 10 2020, 5:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2020, 5:03 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
vsk requested review of this revision.Nov 10 2020, 5:03 PM
This revision is now accepted and ready to land.Nov 10 2020, 10:09 PM
This revision was landed with ongoing or failed builds.Nov 11 2020, 10:16 AM
This revision was automatically updated to reflect the committed changes.

I discussed this with KevinE in the past and he was adamant that he didn't want LC_IDENT being used for this. I don't have strong feelings. I think it was an old load command used for something else altogether decades ago and it started getting used in kernel corefiles and he wasn't thrilled with that. There is a Mach-O LC_NOTE load command that allows for the kernel version string to be stored in the kernel file ("kern ver str") but it hasn't been adopted by darwin kernel dumpers yet.

to be clear: I don't object to ignoring this in the llvm tools, but it was an intentional decision in the past. I don't think that should weigh especially heavily on us today though.