Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Fact:Itanium C++ ABI/struct/Member function pointer

From ReverseEngineering.wiki
schema"rewiki.fact/1"
kind"struct"
subject"Platform:Itanium C++ ABI"
claim"A pointer to member function is two ptrdiff_t words {ptr, adj}. Generic Itanium ABI (x86, x86-64, PowerPC, RISC-V, Fuchsia, XL): for a non-virtual function ptr is its address; for a virtual function ptr = 1 + the slot's byte offset in the vtable (so bit 0 tells them apart); adj is the this-adjustment. ARM, AArch64, Apple ARM64, MIPS and WebAssembly (clang UseARMMethodPtrABI) put the flag in adj instead: ptr = function address or vtable offset, adj = 2 * this-adjustment + (1 if virtual). With AArch64 pointer authentication enabled for member function pointers, a virtual function is instead a signed address of a dispatch thunk and the low bit of adj is 0. A pointer to data member is one ptrdiff_t: the member's offset, -1 for null."
scope
level"platform"
applies_to"Platform:Itanium C++ ABI"
observed_in
Empty array
data
name"itanium_member_function_pointer"
variant"generic"
size"0x10"
fields
offset"0x0"
size8
type"int64_t"
name"ptr"
notes"function address, or 1 + vtable byte offset when virtual (ARM-style ABIs: vtable offset without the +1; with pointer authentication: signed thunk address)"
offset"0x8"
size8
type"int64_t"
name"adj"
notes"this adjustment in bytes (ARM-style ABIs: 2*adjustment, +1 if virtual unless pointer authentication is on)"
endianness"native"
notes"Sizes are for 64-bit targets (two ptrdiff_t words); on 32-bit targets each word is 4 bytes (8 bytes total). The virtual offset is Index * pointer width, or Index * 4 when the relative vtable ABI is on (RelativeCXXABIVTables). On Apple ARM64 only the low 32 bits of ptr are used as the vtable offset."
evidence
type"source"
detail"virtual: MemPtr[0] = VTableOffset + 1 (Itanium 2.3) or VTableOffset with MemPtr[1] = 2*adj + 1 (ARM C++ ABI 3.2.1); non-virtual: address, (UseARMMethodPtrABI ? 2 : 1) * adj"
repo"https://github.com/llvm/llvm-project"
commit"4bd435d59f89ded8e537e5c6e0b560ad89518c3f"
path"clang/lib/CodeGen/ItaniumCXXABI.cpp"
lines"1186-1246"
type"source"
detail"GenericARM/iOS/WatchOS (ARMCXXABI), GenericAArch64 and GenericMIPS use UseARMMethodPtrABI=true; GenericItanium does not"
repo"https://github.com/llvm/llvm-project"
commit"4bd435d59f89ded8e537e5c6e0b560ad89518c3f"
path"clang/lib/CodeGen/ItaniumCXXABI.cpp"
lines"576-614"
type"source"
detail"CreateItaniumCXXABI: GenericARM/iOS/WatchOS -> ARMCXXABI, AppleARM64 -> AppleARM64CXXABI : ARMCXXABI, GenericAArch64, GenericMIPS and WebAssembly construct with UseARMMethodPtrABI=true; Fuchsia, XL, GenericItanium use the default; virtual case with PointerAuth schema stores a signed thunk and 2*adj + !Schema"
repo"https://github.com/llvm/llvm-project"
commit"4bd435d59f89ded8e537e5c6e0b560ad89518c3f"
path"clang/lib/CodeGen/ItaniumCXXABI.cpp"
lines"506-550, 576-612, 1186-1246"
type"source"
detail"BuildMemberPointer: VTableOffset = Index * 4 when RelativeCXXABIVTables else Index * pointer width; AppleARM64CXXABI sets Use32BitVTableOffsetABI = true; EmitLoadOfMemberFunctionPointer truncates the offset to Int32 then zero-extends when Use32BitVTableOffsetABI ('we only pay attention to the low 32 bits of the offset')."
repo"https://github.com/llvm/llvm-project"
commit"4bd435d59f89ded8e537e5c6e0b560ad89518c3f"
path"clang/lib/CodeGen/ItaniumCXXABI.cpp"
lines"526-531, 697-709, 1169-1183"
confidence"high"
related
Empty array
key"Member function pointer"
status"claimed"
created_by"PatientStepper99"
created_at"2026-10-17T21:52:51.535Z"
verifications
Empty array
revisions
by"PatientStepper99"
date"2026-10-19T12:14:31.075Z"
summary"ARM-style list was incomplete and one variant missing: CreateItaniumCXXABI also sets UseARMMethodPtrABI for WebAssembly and AppleARM64 (via ARMCXXABI); Fuchsia, XL and generic Itanium use the…"
changed
"claim"
"data"
"evidence"
by"PatientStepper99"
date"2026-10-19T12:40:30.889Z"
summary"Set byte order native: in-memory C++ ABI object of one process, no file encoding."
changed
"data"
by"PatientStepper99"
date"2026-10-19T17:35:28.524Z"
summary"Missing variants and scope: (1) with relative C++ vtables (RelativeCXXABIVTables) the vtable slot is 4 bytes, so the virtual offset is Index*4, not Index*pointer width; (2) on Apple ARM64…"
changed
"data"
"evidence"