This is an archive of the discontinued LLVM Phabricator instance.

[BinaryFormat] Update Mach-O ARM64E CPU subtype and dumping
ClosedPublic

Authored by smeenai on Feb 25 2019, 10:01 AM.

Details

Summary

The new value is taken from <mach/machine.h> in the MacOSX10.14 SDK from
Xcode 10.1. Update llvm-objdump and llvm-readobj accordingly.

Event Timeline

smeenai created this revision.Feb 25 2019, 10:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 25 2019, 10:01 AM

Shouldn't there be an accompanying change to readobj to display the values for the object files?

mtrent requested changes to this revision.EditedFeb 26 2019, 3:00 PM
mtrent added a reviewer: ab.

I agree, simply updating the enum by itself doesn't accomplish much. Is there something specific driving this change?

EDIT: I mean, is there something specific driving the change other than simply updating to match the macOS 10.14 SDK?

This revision now requires changes to proceed.Feb 26 2019, 3:00 PM

I was planning on doing the objdump change as a follow-up, but you're right that this change doesn't really accomplish anything as-is :) I'll fold the objdump change into this patch.

smeenai updated this revision to Diff 188647.Feb 27 2019, 4:44 PM
smeenai retitled this revision from [BinaryFormat] Update Mach-O ARM64 CPU subtypes to [BinaryFormat] Update Mach-O ARM64 CPU subtypes and dumping.
smeenai edited the summary of this revision. (Show Details)

Add objdump and readobj changes

Of the code additions in this change, I'm only adding a test for one block, because that was the only block I could find related tests for. I'm happy to add tests for the other code blocks for my specific changes, but I don't have the bandwidth to improve the general coverage for them right now.

Note that Apple's objdump (from Xcode 10.1) does print a symbolic subtype for arm64e but not for arm64_v8 (it just prints the numeric subtype there). I don't know if arm64_v8 is actually used for anything right now, and I'm happy to limit this change to just arm64e if Apple prefers.

There's one other block that references CPU_SUBTYPE_ARM64_ALL that I haven't updated, because I don't know what the appropriate values for the new subtypes should be: https://github.com/llvm/llvm-project/blob/95bb3c3cc3f74d2448e6a495c6989f988c24770c/llvm/lib/Object/MachOObjectFile.cpp#L2628

smeenai updated this revision to Diff 189391.Mar 5 2019, 1:05 PM
smeenai retitled this revision from [BinaryFormat] Update Mach-O ARM64 CPU subtypes and dumping to [BinaryFormat] Update Mach-O ARM64E CPU subtype and dumping.
smeenai edited the summary of this revision. (Show Details)

Limit to arm64e, since that's all Apple tools appear to support

compnerd accepted this revision.Mar 6 2019, 2:47 PM
ab added a comment.Mar 6 2019, 2:52 PM

Hmm, if I may: what do you want to support? I'd expect Apple to upstream their own patches.

mtrent added a comment.Mar 6 2019, 2:53 PM

Ping.

I'm hoping we can get Ahmed to comment on this review, since this may conflict with the changes he is trying to land.

In D58636#1420657, @ab wrote:

Hmm, if I may: what do you want to support? I'd expect Apple to upstream their own patches.

I'm playing around with ld64, which requires TAPI for reading tbd files. The existing open source release of TAPI doesn't support arm64e, so it chokes on tbd files from Xcode 10. Adding the CPU_SUBTYPE_ARM64E constant to LLVM allows adding basic arm64e support to TAPI.

From this conversation, it sounds like the arm64e bits might be getting upstreamed soon, which is exciting. I don't know what the timeline on that is like though, and this seems like a small piece that should be pretty similar (if not identical) to what you have internally, so I was hoping it would be okay to land it independently.

Ping @ab. Any objections to me landing this?

Ping @ab. Any objections to me landing this?

@ab, @mtrent – this is a small patch, and I can keep it locally if need be, especially if all the arm64e work will be upstreamed soon. With that said, I'd really appreciate any input on whether this is okay or not from the perspective of conflicting with Apple's planned arm64e upstreaming, and what the timeline on that upstreaming might look like. Also CC'ing @ributzka, since TAPI was my motivation for adding this.

ab accepted this revision.Apr 8 2019, 12:20 PM

Sorry for the delay; go ahead, the patch looks OK.

This revision was not accepted when it landed; it landed in state Needs Review.Apr 8 2019, 2:35 PM
This revision was automatically updated to reflect the committed changes.