oceanbase / oceanbase/seekdb

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

Open
#780 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.9k
Forks
342
Avg merge
2d 14h
Merged PRs (30d)
53

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the aarch64 shim in src/objit/src/core/ob_orc_jit.cpp around lines 126–139, then compare its callbacks with the LLVM RuntimeDyld declarations and the related methods in src/objit/src/core/ob_jit_memory_manager.h around lines 323–345. Reproduce the failure by building the objit target on aarch64. Done means the affected sources compile successfully and the objit build completes without the reported override or access errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.