Skip to content

Build the TIP forwarder DLL with LLVM toolchain - #1629

Open
yukawa wants to merge 1 commit into
google:masterfrom
ciceroaware:issue_1627_followup
Open

yukawa wants to merge 1 commit into
google:masterfrom
ciceroaware:issue_1627_followup

Conversation

@yukawa

@yukawa yukawa commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

Description

This is a follow-up to the previous commit (f120a75) for #1627, which started passing /DEPENDENTLOADFLAG:0x100 when linking the ARM64X pure forwarder DLL (mozc_tip64x.dll).

As already pointed out in #1627, MSVC link.exe (as of 14.52.37025) writes DependentLoadFlags only into the load config of the ARM64 view, leaving it 0 in the x64 (ARM64EC) view. As a result, x64 processes running on ARM64 Windows were not covered by that fix. lld-link sets it in both views.

link.exe lld-link
ARM64 view 0x100 0x100
x64 (ARM64EC) view 0x0 0x100

With this commit, build_tip_forwarder_dll.py uses clang-cl and lld-link instead of cl.exe and link.exe.

Other than that, this commit also addresses pyrefly lint errors.

Issue IDs

Steps to test new behaviors (if any)

  • OS: Windows 11 26H2
  • Steps:
    1. Build the installer that contains mozc_tip64x.dll.
      bazelisk build package --config release_build --config win_universal_installer
      
    2. Run llvm-readobj --coff-load-config bazel-bin\win32\tip\mozc_tip64x.dll.
    3. Confirm DependentLoadFlags: 0x100 is shown twice: once for the ARM64 view and once under HybridObject (the x64 view). It was 0x0 under HybridObject before this PR.
    4. Install bazel-bin\win32\installer\Mozc64.msi on ARM64 Windows.
    5. Run the following with an x64 build of Python.
      python -c "import ctypes, platform; k = ctypes.WinDLL('kernel32'); k.LoadLibraryExW.restype = ctypes.c_void_p; k.GetProcAddress.argtypes = [ctypes.c_void_p, ctypes.c_char_p]; k.GetProcAddress.restype = ctypes.c_void_p; h = k.LoadLibraryExW(r'C:\Program Files (x86)\Mozc\mozc_tip64x.dll', None, 0); print(platform.machine(), bool(h), bool(k.GetProcAddress(h, b'DllCanUnloadNow')))"
      
    6. Confirm it prints AMD64 True True. It was AMD64 True False before this PR.
    7. Confirm Mozc still works in ARM64 apps, including the Settings app and the taskbar search box (ARM64X forwarder mozc_tip64x.dll should have LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR in its DependentLoadFlags #1627), and in x64 apps.

This is a follow-up to the previous commit [1] for google#1627, which started
passing /DEPENDENTLOADFLAG:0x100 when linking the ARM64X pure forwarder
DLL (mozc_tip64x.dll).

As already pointed out in google#1627, MSVC link.exe (as of 14.52.37025)
writes DependentLoadFlags only into the load config of the ARM64 view,
leaving it 0 in the x64 (ARM64EC) view. As a result, x64 processes
running on ARM64 Windows were not covered by that fix. lld-link sets it
in both views.

                          link.exe  lld-link
  ARM64 view                 0x100     0x100
  x64 (ARM64EC) view           0x0     0x100

With this commit, build_tip_forwarder_dll.py uses clang-cl and lld-link
instead of cl.exe and link.exe.

Other than that, this commit also addresses pyrefly lint errors.

 [1]: f120a75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant