Skip to content

Build failure on aarch64 (macOS): LLVM Align vs uint32_t in ObJitMemoryManagerShim::reserveAllocationSpace #780

@longdafeng

Description

@longdafeng

Summary

On aarch64 (Apple Silicon / Linux ARM64), building objit fails with 3 compile errors in ob_orc_jit.cpp related to ObJitMemoryManagerShim::reserveAllocationSpace and needsToReserveAllocationSpace.

Environment

  • Platform: aarch64 (arm64), macOS 15.7.4
  • LLVM headers: bundled devtools under deps/3rd/usr/local/oceanbase/devtools/include/llvm/
  • Affected target: src/objit/src/CMakeFiles/objit_objects.dir/core/ob_orc_jit.cpp.o

Build errors

src/objit/src/core/ob_orc_jit.cpp:129:75: error: non-virtual member function marked 'override' hides virtual member function
  129 |                               uintptr_t RWDataSize, uint32_t RWDataAlign) override
      |                                                                           ^
deps/3rd/usr/local/oceanbase/devtools/include/llvm/ExecutionEngine/RuntimeDyld.h:137:18: note: hidden overloaded virtual function 'llvm::RuntimeDyld::MemoryManager::reserveAllocationSpace' declared here: type mismatch at 2nd parameter ('Align' vs 'uint32_t' (aka 'unsigned int'))
  137 |     virtual void reserveAllocationSpace(uintptr_t CodeSize, Align CodeAlign,
      |                  ^

src/objit/src/core/ob_orc_jit.cpp:131:16: error: 'reserveAllocationSpace' is a private member of 'oceanbase::jit::core::ObJitMemoryManager'
  131 |     delegate_->reserveAllocationSpace(CodeSize, CodeAlign,
      |                ^
src/objit/src/core/ob_jit_memory_manager.h:332:16: note: declared private here

src/objit/src/core/ob_orc_jit.cpp:138:23: error: 'needsToReserveAllocationSpace' is a private member of 'oceanbase::jit::core::ObJitMemoryManager'
  138 |     return delegate_->needsToReserveAllocationSpace();
      |                       ^
src/objit/src/core/ob_jit_memory_manager.h:344:16: note: declared private here

Root cause

Two separate problems in the __aarch64__ block of ObJitMemoryManagerShim (ob_orc_jit.cpp):

1. LLVM API signature mismatch

Upstream LLVM RuntimeDyld::MemoryManager::reserveAllocationSpace now uses llvm::Align for alignment parameters:

virtual void reserveAllocationSpace(uintptr_t CodeSize, Align CodeAlign,
                                  uintptr_t RODataSize, Align RODataAlign,
                                  uintptr_t RWDataSize, Align RWDataAlign) {}

ObJitMemoryManagerShim still overrides with uint32_t align parameters, which does not match the base virtual and triggers the "hides virtual member function" error.

ObJitMemoryManager in ob_jit_memory_manager.h also still declares uint32_t align parameters (lines 332–336).

2. Private member access in shim

reserveAllocationSpace and needsToReserveAllocationSpace are private in ObJitMemoryManager. The shim calls delegate_->reserveAllocationSpace(...) directly, which fails access control.

The same file already works around this for finalizeMemory by routing through the base-class virtual:

return static_cast<llvm::RTDyldMemoryManager *>(delegate_)->finalizeMemory(ErrMsg);

The aarch64 callbacks need the same pattern (and updated signatures).

Suggested fix

  1. Update ObJitMemoryManager::reserveAllocationSpace in ob_jit_memory_manager.h to use llvm::Align (convert to integer alignment inside the implementation when calling allocator_.reserve).
  2. In ObJitMemoryManagerShim (ob_orc_jit.cpp), match LLVM’s Align signature in the override.
  3. Delegate via static_cast<llvm::RTDyldMemoryManager *>(delegate_)->reserveAllocationSpace(...) and ->needsToReserveAllocationSpace(), mirroring finalizeMemory.

Relevant files

  • src/objit/src/core/ob_orc_jit.cpp (~lines 126–139, __aarch64__ shim)
  • src/objit/src/core/ob_jit_memory_manager.h (~lines 323–345)
  • deps/3rd/usr/local/oceanbase/devtools/include/llvm/ExecutionEngine/RuntimeDyld.h (~lines 137–143)

Workaround

None known without patching the sources above; the failure is a hard compile error on aarch64 builds that enable the JIT/objit path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions