Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm-readobj -h doesn't display caps on mach-o files #80198

Open
glandium opened this issue Jan 31, 2024 · 2 comments
Open

llvm-readobj -h doesn't display caps on mach-o files #80198

glandium opened this issue Jan 31, 2024 · 2 comments

Comments

@glandium
Copy link
Contributor

% touch foo.c
% clang -o foo.o -c foo.c --target=arm64e-apple-darwin  # using Xcode clang
% llvm-otool -h foo.o
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
 0xfeedfacf 16777228          2  0x80           1     4        360 0x00002000
% llvm-readobj -h foo.o

File: foo.o
Format: Mach-O arm64
Arch: aarch64
AddressSize: 64bit
MachHeader {
  Magic: Magic64 (0xFEEDFACF)
  CpuType: Arm64 (0x100000C)
  CpuSubType: CPU_SUBTYPE_ARM64E (0x2)
  FileType: Relocatable (0x1)
  NumOfLoadCommands: 4
  SizeOfLoadCommands: 360
  Flags [ (0x2000)
    MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
  ]
  Reserved: 0x0
}

That 0x80 is nowhere to be seen in llvm-readobj's output.

@MaskRay
Copy link
Member

MaskRay commented Feb 3, 2024

Nice finding! This bitmask seems undocumented. Upstream clang does not set cpusubtype & CPU_SUBTYPE_MASK.

@glandium
Copy link
Contributor Author

glandium commented Feb 3, 2024

FWIW, this specific value is CPU_SUBTYPE_PTRAUTH_ABI, per mach/machine.h. See also #80200.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants