You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by pe...@apache.org on 2026/07/25 09:00:14 UTC

(openoffice) branch bazel-migration updated (85ebc3fa23 -> aeee5d0983)

This is an automated email from the ASF dual-hosted git repository.

leginee pushed a change to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git


    from 85ebc3fa23 removed an obsolete test again.
     new 3ce2cfc700 update harness
     new 1ca09b6d76 java bridge migrated
     new 7e18bf4e52 OOoRunner basic migration.
     new da6d97753b switch to LLVM Linker if we build debug builds with pbd files
     new 57da26c8dd update build tools to resolve linker mashup
     new 94a0c9a386 update externals to the new modern linker.
     new 3db6ef0622 sal: fix std::min type ambiguity in osl/w32 profile.cxx on x64
     new 1695372c6b build/win64: add x64 (VC9 cross) toolchain, platforms, and arch selection [P1]
     new c1d164c79b build/win64: strip hardcoded _X86_/INTEL from module BUILD files [P2]
     new 866255a120 build/win64: x64 C++/UNO bridge (mscx_uno) + sal/salhelper x64 fixes + round-trip test [P3]
     new a82fa8aef5 vcl/basic/sfx2/unixODBC: Win64 (x64) source fixes
     new e94d98e392 build/win64: BOOST_MEM_FN_ENABLE_CDECL is x86-only (boost::bind on x64) [P4]
     new 4919821241 build/win64: per-module x64 BUILD wiring (defs, manifests, /ENTRY, asm) [P5]
     new 285dc532fb build/win64: CPPU_ENV global + bridge alias + x64 staging wiring [P5]
     new d14d772a5b crashrep/fpicker/cui: Win64 (x64) source fixes
     new 8db47c6cb7 build/win64: NSS/NSPR + CoinMP x64 external overlays [P4]
     new 6759c81b93 build/win64: name the target platforms winXP-x86/winXP-x64 + win_version constraint
     new 1040d136d8 bridges/msvc_win64: fix the x64 C++/UNO bridge (backport origin/windows-amd64)
     new 1ac44d4c16 sal/vcl: Win64 (x64) runtime source fixes -- thread key + window pointers
     new aeee5d0983 build/win64: strip CPPU_ENV=msci from the SUBPACKAGE BUILD files the sweep missed

The 20 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .bazelrc                                           |  25 +-
 CLAUDE.md                                          |  18 +-
 MODULE.bazel                                       |  20 ++
 STYLEGUIDE.md                                      | 216 ++++++++++++
 build/BUILD.bazel                                  |  17 +
 build/constraints/BUILD.bazel                      |  54 +++
 build/platforms/BUILD.bazel                        |  42 +++
 build/rules/gtest_test.bzl                         |   7 +
 build/rules/localedata_pipeline.bzl                |  18 +-
 build/toolchain/BUILD.bazel                        | 160 ++++++++-
 build/toolchain/windows_cc_toolchain_config.bzl    |  67 +++-
 build/vs_config_repo.bzl                           |  94 +++++-
 .../modules/boost.legacy/1.55.0/MODULE.bazel       |   3 +-
 .../boost.legacy/1.55.0/overlay/BUILD.bazel        |  23 +-
 .../boost.legacy/1.55.0/overlay/MODULE.bazel       |   3 +-
 .../modules/boost.legacy/1.55.0/source.json        |   6 +-
 .../modules/coinmp/1.7.6/overlay/BUILD.bazel       |   4 +-
 ext_libraries/modules/coinmp/1.7.6/source.json     |   2 +-
 .../modules/curl/8.7.1/overlay/BUILD.bazel         |   5 +
 ext_libraries/modules/curl/8.7.1/source.json       |   2 +-
 .../mariadb-connector-c/2.3.7/overlay/BUILD.bazel  |   5 +
 .../modules/mariadb-connector-c/2.3.7/source.json  |   2 +-
 ext_libraries/modules/nss/3.39/overlay/BUILD.bazel |  15 +-
 .../modules/nss/3.39/patches/nss_win.patch         |  32 ++
 ext_libraries/modules/nss/3.39/source.json         |   4 +-
 .../modules/openssl/3.0.13/overlay/BUILD.bazel     |   5 +
 ext_libraries/modules/openssl/3.0.13/source.json   |   2 +-
 main/UnoControls/BUILD.bazel                       |   1 -
 main/accessibility/BUILD.bazel                     |   1 -
 main/animations/BUILD.bazel                        |   1 -
 main/avmedia/BUILD.bazel                           |   1 -
 main/basctl/BUILD.bazel                            |   1 -
 main/basebmp/BUILD.bazel                           |   1 -
 main/basegfx/BUILD.bazel                           |   1 -
 main/basic/BUILD.bazel                             |   9 +-
 main/basic/source/runtime/dllmgr.cxx               |   6 +-
 main/binaryurp/BUILD.bazel                         |   1 -
 main/bridges/BUILD.bazel                           | 374 ++++++++++++++++++++-
 main/bridges/readme.md                             |  74 ++++
 .../source/cpp_uno/msvc_win64_x86-64/abi.cxx       |  10 +-
 .../source/cpp_uno/msvc_win64_x86-64/call.asm      |  80 +++--
 .../source/cpp_uno/msvc_win64_x86-64/cpp2uno.cxx   |  23 +-
 .../source/cpp_uno/msvc_win64_x86-64/except.cxx    |  96 +++++-
 main/bridges/test/cppuno_roundtrip_test.cxx        | 144 ++++++++
 main/bridges/test/inter_libs_exc/starter.def       |   3 +
 main/bridges/test/inter_libs_exc/thrower.def       |   3 +
 main/bridges/util/java_uno.def                     |  16 +
 main/bridges/util/mscx_uno.def                     |   8 +
 main/canvas/BUILD.bazel                            |   1 -
 main/chart2/BUILD.bazel                            |   1 -
 main/codemaker/BUILD.bazel                         |   1 -
 main/comphelper/BUILD.bazel                        |   1 -
 main/configmgr/BUILD.bazel                         |   1 -
 main/connectivity/BUILD.bazel                      |   1 -
 main/cppcanvas/BUILD.bazel                         |   1 -
 main/cppu/BUILD.bazel                              |   1 -
 main/cppuhelper/BUILD.bazel                        |   1 -
 main/cpputools/BUILD.bazel                         |   1 -
 main/crashrep/BUILD.bazel                          |   2 +-
 main/crashrep/source/win32/soreport.cpp            |  76 +++--
 main/cui/BUILD.bazel                               |   1 -
 main/cui/source/options/optdict.cxx                |   4 +-
 main/dbaccess/BUILD.bazel                          |   1 -
 main/desktop/BUILD.bazel                           |  29 +-
 main/desktop/util/amd64/soffice.exe.manifest       |  15 +
 main/drawinglayer/BUILD.bazel                      |   1 -
 main/dtrans/BUILD.bazel                            |   1 -
 main/editeng/BUILD.bazel                           |   1 -
 main/embeddedobj/BUILD.bazel                       |   1 -
 main/embedserv/BUILD.bazel                         |   1 -
 main/eventattacher/BUILD.bazel                     |   1 -
 main/extensions/BUILD.bazel                        |   1 -
 main/extensions/source/oooimprovement/BUILD.bazel  |   1 -
 main/fileaccess/BUILD.bazel                        |   1 -
 main/filter/BUILD.bazel                            |   1 -
 main/forms/BUILD.bazel                             |   1 -
 main/formula/BUILD.bazel                           |   1 -
 main/fpicker/BUILD.bazel                           |   1 -
 .../source/win32/filepicker/FileOpenDlg.cxx        |  22 +-
 .../source/win32/filepicker/FileOpenDlg.hxx        |  10 +-
 .../source/win32/filepicker/WinFileOpenImpl.cxx    |  14 +-
 .../source/win32/filepicker/WinFileOpenImpl.hxx    |   4 +-
 main/framework/BUILD.bazel                         |   1 -
 main/i18npool/BUILD.bazel                          |   1 -
 main/i18npool/pool/BUILD.bazel                     |   1 -
 main/i18nutil/BUILD.bazel                          |   1 -
 main/idl/BUILD.bazel                               |  12 +-
 main/idl/util/amd64/svidl.exe.manifest             |   9 +
 main/idlc/BUILD.bazel                              |   1 -
 main/io/BUILD.bazel                                |   1 -
 main/javaunohelper/BUILD.bazel                     |   1 -
 main/jurt/BUILD.bazel                              |   2 +-
 main/jvmaccess/BUILD.bazel                         |   9 +-
 main/jvmaccess/util/jvmaccessx64.def               |   8 +
 main/jvmfwk/BUILD.bazel                            |   1 -
 main/l10ntools/BUILD.bazel                         |   1 -
 main/lingucomponent/BUILD.bazel                    |   3 -
 main/linguistic/BUILD.bazel                        |   1 -
 main/mysqlc/BUILD.bazel                            |   1 -
 main/o3tl/BUILD.bazel                              |   2 +-
 main/oox/BUILD.bazel                               |   1 -
 main/package/BUILD.bazel                           |   1 -
 main/pyuno/BUILD.bazel                             |   1 -
 main/qadevOOo/BUILD.bazel                          |  32 ++
 main/qadevOOo/readme.md                            |  38 +++
 main/rdbmaker/BUILD.bazel                          |   1 -
 main/registry/BUILD.bazel                          |   1 -
 main/remotebridges/BUILD.bazel                     |   1 -
 main/reportdesign/BUILD.bazel                      |   1 -
 main/rsc/BUILD.bazel                               |   1 -
 main/sal/BUILD.bazel                               |  52 +--
 main/sal/inc/osl/thread.h                          |   7 +-
 main/sal/osl/w32/profile.cxx                       |   2 +-
 main/sal/systools/win32/uwinapi/Uwinapi64.def      |   2 +
 main/salhelper/BUILD.bazel                         |   8 +-
 main/salhelper/util/salhelperx64.def               |  29 ++
 main/sax/BUILD.bazel                               |   1 -
 main/sc/BUILD.bazel                                |   1 -
 main/scaddins/BUILD.bazel                          |   1 -
 main/sccomp/BUILD.bazel                            |   1 -
 main/scripting/BUILD.bazel                         |   1 -
 main/sd/BUILD.bazel                                |   1 -
 main/sdext/BUILD.bazel                             |   1 -
 main/sfx2/BUILD.bazel                              |   1 -
 main/sfx2/source/bastyp/progress.cxx               |   3 +-
 main/shell/BUILD.bazel                             |   9 +-
 main/shell/util/amd64/lngconvex.exe.manifest       |   9 +
 main/slideshow/BUILD.bazel                         |   1 -
 main/sot/BUILD.bazel                               |   1 -
 main/staging/BUILD.bazel                           |  19 +-
 main/starmath/BUILD.bazel                          |   1 -
 main/stoc/BUILD.bazel                              |   1 -
 main/store/BUILD.bazel                             |   1 -
 main/svgio/BUILD.bazel                             |   1 -
 main/svl/BUILD.bazel                               |   1 -
 main/svtools/BUILD.bazel                           |   1 -
 main/svx/BUILD.bazel                               |   1 -
 main/sw/BUILD.bazel                                |   1 -
 main/test/BUILD.bazel                              |   1 -
 main/toolkit/BUILD.bazel                           |   1 -
 main/toolkit/inc/pch/boost_bind_msvc_fix.hpp       |   6 +-
 main/tools/BUILD.bazel                             |   2 -
 main/ucb/BUILD.bazel                               |   1 -
 main/ucbhelper/BUILD.bazel                         |   1 -
 main/unixODBC/inc/sqltypes.h                       |   1 +
 main/unotools/BUILD.bazel                          |   1 -
 main/unoxml/BUILD.bazel                            |   1 -
 main/uui/BUILD.bazel                               |   1 -
 main/vbahelper/BUILD.bazel                         |   1 -
 main/vcl/BUILD.bazel                               |   9 +-
 main/vcl/inc/win/saldata.hxx                       |  18 +-
 main/vcl/inc/win/wincomp.hxx                       |  14 +-
 main/vcl/source/window/scrwnd.cxx                  |   2 +-
 main/vcl/win/source/app/saldata.cxx                |  18 +-
 main/vcl/win/source/gdi/salgdi.cxx                 |   4 +-
 main/vcl/win/source/window/salframe.cxx            |   4 +-
 main/vos/BUILD.bazel                               |   2 +-
 main/winaccessibility/BUILD.bazel                  |   1 -
 main/writerfilter/BUILD.bazel                      |   1 -
 main/xmlhelp/BUILD.bazel                           |   1 -
 main/xmloff/BUILD.bazel                            |   1 -
 main/xmlreader/BUILD.bazel                         |   1 -
 main/xmlscript/BUILD.bazel                         |   1 -
 main/xmlsecurity/BUILD.bazel                       |   1 -
 164 files changed, 1939 insertions(+), 354 deletions(-)
 create mode 100644 STYLEGUIDE.md
 create mode 100644 build/constraints/BUILD.bazel
 create mode 100644 build/platforms/BUILD.bazel
 create mode 100644 main/bridges/test/cppuno_roundtrip_test.cxx
 create mode 100644 main/bridges/test/inter_libs_exc/starter.def
 create mode 100644 main/bridges/test/inter_libs_exc/thrower.def
 create mode 100644 main/bridges/util/java_uno.def
 create mode 100644 main/bridges/util/mscx_uno.def
 create mode 100644 main/desktop/util/amd64/soffice.exe.manifest
 create mode 100644 main/idl/util/amd64/svidl.exe.manifest
 create mode 100644 main/jvmaccess/util/jvmaccessx64.def
 create mode 100644 main/qadevOOo/BUILD.bazel
 create mode 100644 main/qadevOOo/readme.md
 create mode 100644 main/sal/systools/win32/uwinapi/Uwinapi64.def
 create mode 100644 main/salhelper/util/salhelperx64.def
 create mode 100644 main/shell/util/amd64/lngconvex.exe.manifest


(openoffice) 05/20: update build tools to resolve linker mashup

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 57da26c8dddbfa6d7bdcc45351e4380e071fac05
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Fri Jul 3 00:23:22 2026 +0200

    update build tools to resolve linker mashup
---
 build/toolchain/windows_cc_toolchain_config.bzl | 39 +++++++++++++++----------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/build/toolchain/windows_cc_toolchain_config.bzl b/build/toolchain/windows_cc_toolchain_config.bzl
index 85924bb390..9f17165cb6 100644
--- a/build/toolchain/windows_cc_toolchain_config.bzl
+++ b/build/toolchain/windows_cc_toolchain_config.bzl
@@ -149,13 +149,14 @@ def _impl(ctx):
         # Linker tool selection for the executable / dynamic-library link actions.
         # When the generate_pdb feature is enabled (debug builds that emit .pdb),
         # Bazel runs a modern MSVC link.exe (pdb_link_path, auto-discovered from a
-        # VS2017+/BuildTools install). The VC9 linker's single mspdbsrv cannot
-        # write PDBs in parallel (LNK1318 0x6BA; VC9 has no /FS), while a modern
-        # link.exe reads the VC9 /Z7 objects natively and its mspdbsrv handles
-        # parallel PDB writes — so debug builds run at full --jobs. (LLVM lld-link
-        # was rejected: it cannot emit PDBs from VC9-era CodeView.) Every other
-        # link stays on VC9 link.exe so shipped (non-PDB) binaries are produced by
-        # the same linker as before. Bazel selects the first tool whose
+        # VS2017+/BuildTools install), whose mspdbsrv writes PDBs in parallel so
+        # /DEBUG links run at full --jobs (VC9's single mspdbsrv cannot: LNK1318
+        # 0x6BA, no /FS). The modern linker consumes VC9 /Z7 objects only under
+        # /DEBUG:FASTLINK — its full CodeView→PDB *merge* (plain /DEBUG) access-
+        # violates on VC9-era CodeView (0xC0000005, e.g. //main/sal:sal3), so the
+        # generate_pdb feature passes /DEBUG:FASTLINK (see generate_pdb_linker_feature).
+        # Every other link stays on VC9 link.exe so shipped (non-PDB) binaries are
+        # produced by the same linker as before. Bazel selects the first tool whose
         # with_features set matches the active feature configuration.
         link_tools = [
             tool(
@@ -1384,14 +1385,22 @@ def _impl(ctx):
             flag_sets = [
                 flag_set(
                     actions = all_link_actions,
-                    # /DEBUG: emit the separate .pdb.
-                    # /SAFESEH:NO: this feature routes links through lld-link (see
-                    # link_tools), which — unlike VC9 link.exe — enforces /safeseh
-                    # on x86 and rejects data-only objects that carry no SEH table
-                    # (e.g. ICU's icudt49_dat.obj). SafeSEH is a ship-time mitigation
-                    # and these are non-distributed debug binaries, so disabling it
-                    # here is harmless and only affects the generate_pdb path.
-                    flag_groups = [flag_group(flags = ["/DEBUG", "/SAFESEH:NO"])],
+                    # /DEBUG:FASTLINK — not plain /DEBUG (= /DEBUG:FULL). This feature
+                    # routes links through the modern VS2017+/BuildTools link.exe (see
+                    # link_tools), whose full CodeView→PDB *merge* access-violates
+                    # (0xC0000005) on the VC9-era CodeView emitted by VC9 cl.exe's /Z7
+                    # objects (e.g. //main/sal:sal3). FASTLINK skips that merge and
+                    # emits a partial .pdb that references the /Z7 debug info left in
+                    # the .obj/.lib under bazel-out — fine for on-machine debugging of
+                    # these non-distributed debug binaries. VC9 link.exe is the only
+                    # linker that can produce a full standalone PDB from these objects,
+                    # but it cannot write PDBs in parallel (LNK1318 0x6BA, no /FS).
+                    # /SAFESEH:NO: the modern linker — unlike VC9 link.exe — enforces
+                    # /safeseh on x86 and rejects data-only objects that carry no SEH
+                    # table (e.g. ICU's icudt49_dat.obj). SafeSEH is a ship-time
+                    # mitigation and these are non-distributed debug binaries, so
+                    # disabling it here is harmless and only affects the generate_pdb path.
+                    flag_groups = [flag_group(flags = ["/DEBUG:FASTLINK", "/SAFESEH:NO"])],
                 ),
             ],
         )


(openoffice) 11/20: vcl/basic/sfx2/unixODBC: Win64 (x64) source fixes

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit a82fa8aef582f462d3f5518690eb9c6c33e5e8d0
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Wed Jul 22 00:55:30 2026 +0200

    vcl/basic/sfx2/unixODBC: Win64 (x64) source fixes
    
    Source-level fixes needed to compile/link these modules for Windows x86-64
    (VS2008 x64).  Each is arch-neutral or arch-guarded, so the x86 build is
    unchanged; isolated here so they can be cherry-picked onto the dmake
    windows-amd64 branch / upstream.
    
    - vcl/inc/win/wincomp.hxx: the pointer/handle class- and window-long indices
      GCL_HCURSOR/GCL_HICON/GCL_HBRBACKGROUND and GWL_HINSTANCE do not exist on
      Win64; use GCLP_*/GWLP_* with SetClassLongPtr/GetClassLongPtr/
      GetWindowLongPtr and (LONG_PTR) casts (compile on x86 too).
    - vcl/win/source/window/salframe.cxx: PtrToInt(wParam) misused on the integer
      IME request code (WPARAM is 64-bit on x64) -> static_cast<int>.
    - vcl/win/source/gdi/salgdi.cxx: ImplPreparePolyDraw took const sal_uLong* while
      the drawPolyPolygon* callers pass const sal_uInt32* (distinct pointer types on
      x64) -> sal_uInt32*.
    - vcl/source/window/scrwnd.cxx: Max(sal_uIntPtr, 1UL) ambiguous on x64 (sal_uIntPtr
      is 64-bit, 1UL is unsigned long) -> Max(..., sal_uIntPtr(1UL)).
    - basic/source/runtime/dllmgr.cxx: the DllMgr_call32/callFp trampolines (wnt.asm)
      are x86 stdcall only; guard #if defined WNT -> #if defined(WNT) && !defined(_WIN64)
      so x64 uses the existing not-implemented stub (Basic Declare'd DLL calls
      unsupported on x64 until an x64 trampoline is written).
    - sfx2/source/bastyp/progress.cxx: extern Get10ThSec declared sal_uIntPtr but the
      definition returns sal_uInt32; these coincide on x86 but diverge on x64 (link
      error) -> declare sal_uInt32.
    - unixODBC/inc/sqltypes.h: the _WIN64 branch uses INT64/UINT64 for SQLLEN/SQLULEN
      without pulling them in -> #include <basetsd.h> (arch-guarded).
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit ca1383cbf9353b4189783687c37e993025edf764)
---
 main/basic/source/runtime/dllmgr.cxx    |  6 +++++-
 main/sfx2/source/bastyp/progress.cxx    |  3 ++-
 main/unixODBC/inc/sqltypes.h            |  1 +
 main/vcl/inc/win/wincomp.hxx            | 14 +++++++-------
 main/vcl/source/window/scrwnd.cxx       |  2 +-
 main/vcl/win/source/gdi/salgdi.cxx      |  4 ++--
 main/vcl/win/source/window/salframe.cxx |  4 ++--
 7 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/main/basic/source/runtime/dllmgr.cxx b/main/basic/source/runtime/dllmgr.cxx
index d31420340b..6a3adcdc7e 100644
--- a/main/basic/source/runtime/dllmgr.cxx
+++ b/main/basic/source/runtime/dllmgr.cxx
@@ -60,7 +60,11 @@
    variables accordingly.
 */
 
-#if defined WNT // only 32-bit Windows, actually
+#if defined(WNT) && !defined(_WIN64) // only 32-bit Windows: the DllMgr_call32/callFp
+                                     // trampolines (wnt.asm) are x86 stdcall only.
+                                     // x64 falls through to the not-implemented stub
+                                     // below (Basic Declare'd DLL calls unsupported on
+                                     // x64 until an x64 trampoline is written).
 
 extern "C" {
 
diff --git a/main/sfx2/source/bastyp/progress.cxx b/main/sfx2/source/bastyp/progress.cxx
index efacc2cfd1..3e189c066a 100644
--- a/main/sfx2/source/bastyp/progress.cxx
+++ b/main/sfx2/source/bastyp/progress.cxx
@@ -110,7 +110,8 @@ struct SfxProgress_Impl
 #define aTypeLibInfo aProgressTypeLibImpl
 
 //========================================================================
-extern sal_uIntPtr Get10ThSec();
+extern sal_uInt32 Get10ThSec();  // must match the definition in sfxbasecontroller.cxx
+                                 // (sal_uInt32); sal_uIntPtr diverges from it on x64
 
 // -----------------------------------------------------------------------
 
diff --git a/main/unixODBC/inc/sqltypes.h b/main/unixODBC/inc/sqltypes.h
index 399f702834..31171490b6 100644
--- a/main/unixODBC/inc/sqltypes.h
+++ b/main/unixODBC/inc/sqltypes.h
@@ -146,6 +146,7 @@ typedef unsigned char		SQLVARCHAR;
  *  New Win64 datatypes
  */
 #ifdef _WIN64
+#include <basetsd.h>			/* INT64 / UINT64 (not otherwise pulled in here) */
 typedef INT64			SQLLEN;
 typedef UINT64			SQLULEN;
 typedef UINT64			SQLSETPOSIROW;
diff --git a/main/vcl/inc/win/wincomp.hxx b/main/vcl/inc/win/wincomp.hxx
index e0bea9893b..60cc88b02c 100644
--- a/main/vcl/inc/win/wincomp.hxx
+++ b/main/vcl/inc/win/wincomp.hxx
@@ -146,37 +146,37 @@ inline HFONT GetWindowFont( HWND hWnd )
 
 inline void SetClassCursor( HWND hWnd, HCURSOR hCursor )
 {
-	SetClassLong( hWnd, GCL_HCURSOR, (DWORD)hCursor );
+	SetClassLongPtr( hWnd, GCLP_HCURSOR, (LONG_PTR)hCursor );
 }
 
 inline HCURSOR GetClassCursor( HWND hWnd )
 {
-	return (HCURSOR)GetClassLong( hWnd, GCL_HCURSOR );
+	return (HCURSOR)GetClassLongPtr( hWnd, GCLP_HCURSOR );
 }
 
 inline void SetClassIcon( HWND hWnd, HICON hIcon )
 {
-	SetClassLong( hWnd, GCL_HICON, (DWORD)hIcon );
+	SetClassLongPtr( hWnd, GCLP_HICON, (LONG_PTR)hIcon );
 }
 
 inline HICON GetClassIcon( HWND hWnd )
 {
-	return (HICON)GetClassLong( hWnd, GCL_HICON );
+	return (HICON)GetClassLongPtr( hWnd, GCLP_HICON );
 }
 
 inline HBRUSH SetClassBrush( HWND hWnd, HBRUSH hBrush )
 {
-	return (HBRUSH)SetClassLong( hWnd, GCL_HBRBACKGROUND, (DWORD)hBrush );
+	return (HBRUSH)SetClassLongPtr( hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)hBrush );
 }
 
 inline HBRUSH GetClassBrush( HWND hWnd )
 {
-	return (HBRUSH)GetClassLong( hWnd, GCL_HBRBACKGROUND );
+	return (HBRUSH)GetClassLongPtr( hWnd, GCLP_HBRBACKGROUND );
 }
 
 inline HINSTANCE GetWindowInstance( HWND hWnd )
 {
-	return (HINSTANCE)GetWindowLong( hWnd, GWL_HINSTANCE );
+	return (HINSTANCE)GetWindowLongPtr( hWnd, GWLP_HINSTANCE );
 }
 
 // ------------------------
diff --git a/main/vcl/source/window/scrwnd.cxx b/main/vcl/source/window/scrwnd.cxx
index eeb0c43811..9cd21452b5 100644
--- a/main/vcl/source/window/scrwnd.cxx
+++ b/main/vcl/source/window/scrwnd.cxx
@@ -394,7 +394,7 @@ IMPL_LINK( ImplWheelWindow, ImplScrollHdl, Timer*, EMPTYARG )
 			pWindow->Command( aCEvt );
 			if( aDel.IsDead() )
 				return 0;
-			mnRepaintTime = Max( Time::GetSystemTicks() - nTime, 1UL );
+			mnRepaintTime = Max( Time::GetSystemTicks() - nTime, sal_uIntPtr(1UL) );
 			ImplRecalcScrollValues();
 		}
 	}
diff --git a/main/vcl/win/source/gdi/salgdi.cxx b/main/vcl/win/source/gdi/salgdi.cxx
index 53453a0ec3..fc033a8844 100644
--- a/main/vcl/win/source/gdi/salgdi.cxx
+++ b/main/vcl/win/source/gdi/salgdi.cxx
@@ -622,7 +622,7 @@ void ImplClearHDCCache( SalData* pData )
 // Make sure pWinPointAry and pWinFlagAry are big enough
 void ImplPreparePolyDraw( bool						bCloseFigures,
                           sal_uLong 					nPoly,
-                          const sal_uLong* 				pPoints,
+                          const sal_uInt32* 				pPoints,
                           const SalPoint* const* 	pPtAry,
                           const BYTE* const* 		pFlgAry,
                           POINT* 					pWinPointAry,
@@ -1601,7 +1601,7 @@ sal_Bool WinSalGraphics::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt
 				"WinSalGraphics::DrawPolyPolygonBezier(): POINT != SalPoint" );
 
     sal_uLong nCurrPoly, nTotalPoints;
-    const sal_uLong* pCurrPoints = pPoints;
+    const sal_uInt32* pCurrPoints = pPoints;
     for( nCurrPoly=0, nTotalPoints=0; nCurrPoly<nPoly; ++nCurrPoly )
         nTotalPoints += *pCurrPoints++;
 
diff --git a/main/vcl/win/source/window/salframe.cxx b/main/vcl/win/source/window/salframe.cxx
index 7e0fe04a44..703fd76bef 100644
--- a/main/vcl/win/source/window/salframe.cxx
+++ b/main/vcl/win/source/window/salframe.cxx
@@ -6249,12 +6249,12 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
             break;
 #if WINVER >= 0x0500
         case WM_IME_REQUEST:
-            if ( PtrToInt( wParam ) == IMR_RECONVERTSTRING )
+            if ( static_cast<int>( wParam ) == IMR_RECONVERTSTRING )
             {
                 nRet = ImplHandleIMEReconvertString( hWnd, lParam );
                 rDef = FALSE;
             }
-	    else if( PtrToInt( wParam ) == IMR_CONFIRMRECONVERTSTRING )
+	    else if( static_cast<int>( wParam ) == IMR_CONFIRMRECONVERTSTRING )
 	    {
 		nRet = ImplHandleIMEConfirmReconvertString( hWnd, lParam );
 		rDef = FALSE;


(openoffice) 12/20: build/win64: BOOST_MEM_FN_ENABLE_CDECL is x86-only (boost::bind on x64) [P4]

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit e94d98e3929e4048dda6f3dae47ccdf173a1e5f1
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Wed Jul 22 00:55:44 2026 +0200

    build/win64: BOOST_MEM_FN_ENABLE_CDECL is x86-only (boost::bind on x64) [P4]
    
    On x86, MSVC member functions default to __thiscall (!= SAL_CALL __cdecl), so
    boost needs the explicit __cdecl mem_fn overload (BOOST_MEM_FN_ENABLE_CDECL) or
    boost::bind fails (C2825).  On x64 there is a single calling convention (__cdecl),
    so that overload duplicates the default mf1 and boost::bind becomes ambiguous
    (C2668, first seen in basegfx/debugplotter.cxx).  Make the define x86-only in both
    places that set it:
    
    - boost.legacy overlay BUILD.bazel: defines = select() on a local ":x64"
      config_setting (@platforms//cpu:x86_64); add platforms as a bazel_dep in the
      overlay AND registry MODULE.bazel so the constraint resolves; re-pin the overlay
      BUILD/MODULE sha256 in source.json (hash-pinned bzlmod registry).
    - toolkit/inc/pch/boost_bind_msvc_fix.hpp (force-included): #ifdef _MSC_VER ->
      #if defined(_MSC_VER) && !defined(_WIN64).
    
    Covers every boost::bind/mem_fn consumer on x64.
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit 7734afe7d03306c987890afaab1f521c72d5b8c4)
---
 .../modules/boost.legacy/1.55.0/MODULE.bazel       |  3 ++-
 .../boost.legacy/1.55.0/overlay/BUILD.bazel        | 23 ++++++++++++++++++----
 .../boost.legacy/1.55.0/overlay/MODULE.bazel       |  3 ++-
 .../modules/boost.legacy/1.55.0/source.json        |  6 +++---
 main/toolkit/inc/pch/boost_bind_msvc_fix.hpp       |  6 +++++-
 5 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/ext_libraries/modules/boost.legacy/1.55.0/MODULE.bazel b/ext_libraries/modules/boost.legacy/1.55.0/MODULE.bazel
index 9c40dc4f16..006d6cd316 100644
--- a/ext_libraries/modules/boost.legacy/1.55.0/MODULE.bazel
+++ b/ext_libraries/modules/boost.legacy/1.55.0/MODULE.bazel
@@ -3,4 +3,5 @@ module(
     version = "1.55.0",
 )
 
-bazel_dep(name = "rules_cc",         version = "0.2.17")
\ No newline at end of file
+bazel_dep(name = "rules_cc",         version = "0.2.17")
+bazel_dep(name = "platforms",        version = "1.0.0")  # for the x64 config_setting in BUILD.bazel
\ No newline at end of file
diff --git a/ext_libraries/modules/boost.legacy/1.55.0/overlay/BUILD.bazel b/ext_libraries/modules/boost.legacy/1.55.0/overlay/BUILD.bazel
index 964da0e594..86ef7b4507 100644
--- a/ext_libraries/modules/boost.legacy/1.55.0/overlay/BUILD.bazel
+++ b/ext_libraries/modules/boost.legacy/1.55.0/overlay/BUILD.bazel
@@ -2,13 +2,28 @@ load("@rules_cc//cc:defs.bzl", "cc_library")
 
 package(default_visibility = ["//visibility:public"])
 
+# x64 detection (local config_setting so this overlay stays self-contained and
+# doesn't reference main-repo labels).
+config_setting(
+    name = "x64",
+    constraint_values = ["@platforms//cpu:x86_64"],
+)
+
 # Boost is header-only for the parts used in AOO (bind, unordered, etc.)
-# BOOST_MEM_FN_ENABLE_CDECL: MSVC 9.0 (VS2008) encodes SAL_CALL (__cdecl) into
-# member-function-pointer types for template argument deduction. Without this
-# define, boost::bind falls through to the generic path and fails with C2825.
+# BOOST_MEM_FN_ENABLE_CDECL (x86 ONLY): on x86, MSVC 9.0 (VS2008) member functions
+# default to __thiscall, which differs from SAL_CALL (__cdecl), so boost needs the
+# explicit __cdecl mem_fn overload for template argument deduction of SAL_CALL
+# member-function pointers — without it boost::bind fails C2825.
+# On x64 there is a SINGLE calling convention (__cdecl), so __thiscall == __cdecl and
+# the explicit-cdecl overload becomes identical to the default one → boost::bind is
+# AMBIGUOUS (C2668).  So the define must NOT be set on x64 (matches wntmscx.mk, which
+# comments it out).
 cc_library(
     name = "boost.legacy",
     hdrs = glob(["boost/**/*.hpp"]),
     includes = ["."],
-    defines = ["BOOST_MEM_FN_ENABLE_CDECL"],
+    defines = select({
+        ":x64": [],
+        "//conditions:default": ["BOOST_MEM_FN_ENABLE_CDECL"],
+    }),
 )
diff --git a/ext_libraries/modules/boost.legacy/1.55.0/overlay/MODULE.bazel b/ext_libraries/modules/boost.legacy/1.55.0/overlay/MODULE.bazel
index 9c40dc4f16..006d6cd316 100644
--- a/ext_libraries/modules/boost.legacy/1.55.0/overlay/MODULE.bazel
+++ b/ext_libraries/modules/boost.legacy/1.55.0/overlay/MODULE.bazel
@@ -3,4 +3,5 @@ module(
     version = "1.55.0",
 )
 
-bazel_dep(name = "rules_cc",         version = "0.2.17")
\ No newline at end of file
+bazel_dep(name = "rules_cc",         version = "0.2.17")
+bazel_dep(name = "platforms",        version = "1.0.0")  # for the x64 config_setting in BUILD.bazel
\ No newline at end of file
diff --git a/ext_libraries/modules/boost.legacy/1.55.0/source.json b/ext_libraries/modules/boost.legacy/1.55.0/source.json
index 248aed0eed..8cf2e31f65 100644
--- a/ext_libraries/modules/boost.legacy/1.55.0/source.json
+++ b/ext_libraries/modules/boost.legacy/1.55.0/source.json
@@ -3,7 +3,7 @@
     "integrity": "sha256-//AAI915SG1ETI4pki9AcuHUUfxaTStgdYUurX8re1I=",
     "strip_prefix": "boost_1_55_0",
     "overlay": {
-        "MODULE.bazel": "sha256-xQ5HsLuRop43OYB2ybc1Lf3bID6S3HI+wsJCWH1WiMA=",
-        "BUILD.bazel": "sha256-jFaYs5fFUumAbmCsk7FOqSfLy4WYJD5dBSt3S/7od9I="
+        "MODULE.bazel": "sha256-pjDVPh7DbLMZVVyThgArsqKgd9FVDNdQ+FOOzgRRjzY=",
+        "BUILD.bazel": "sha256-gAADCK4EYMecaizbqPQrU4tnZEYLmJzO4zAOTcNjcYE="
     }
-}
\ No newline at end of file
+}
diff --git a/main/toolkit/inc/pch/boost_bind_msvc_fix.hpp b/main/toolkit/inc/pch/boost_bind_msvc_fix.hpp
index 8d6801639b..6a79df4aa5 100644
--- a/main/toolkit/inc/pch/boost_bind_msvc_fix.hpp
+++ b/main/toolkit/inc/pch/boost_bind_msvc_fix.hpp
@@ -16,7 +16,11 @@
 // The original AOO build used MinGW/GCC which ignores both calling convention
 // and exception specs in template type matching, so no fix was needed there.
 
-#ifdef _MSC_VER
+// x86 ONLY: on x64 there is a single calling convention (__cdecl), so the default
+// boost mf1 overload already matches SAL_CALL member pointers; defining
+// BOOST_MEM_FN_ENABLE_CDECL there makes mf1_cdecl duplicate mf1 → boost::bind
+// C2668 ambiguous.  Matches the x86-only handling in the boost.legacy overlay.
+#if defined(_MSC_VER) && !defined(_WIN64)
 #  define BOOST_MEM_FN_ENABLE_CDECL
 #endif
 


(openoffice) 20/20: build/win64: strip CPPU_ENV=msci from the SUBPACKAGE BUILD files the sweep missed

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit aeee5d0983e18d07aa60722c6ea7f0716f15ee05
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Sat Jul 25 10:48:12 2026 +0200

    build/win64: strip CPPU_ENV=msci from the SUBPACKAGE BUILD files the sweep missed
    
    The earlier CPPU_ENV-global change swept "for f in main/*/BUILD.bazel", which
    does not match nested BUILD files.  main/i18npool/pool/BUILD.bazel (builds
    i18npool.dll) and main/extensions/source/oooimprovement/BUILD.bazel still forced
    CPPU_ENV=msci, which overrides the toolchain's global mscx on x64 (per-target
    defines come after the toolchain defaults, last-wins).  So i18npool.dll compiled
    as msci -> its LocaleData / CharacterClassification components reported the x86
    UNO environment on x64 -> shlib.cxx "cannot get uno environments!" FatalError
    (env.is=0) during startup.
    
    Strip the literals so both rely on the global arch_defines like every other
    module.  Swept every BUILD.bazel at any depth to confirm none remain.
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit e8baa4edf1cad0690c66211c6a720568f935b358)
---
 main/extensions/source/oooimprovement/BUILD.bazel | 1 -
 main/i18npool/pool/BUILD.bazel                    | 1 -
 2 files changed, 2 deletions(-)

diff --git a/main/extensions/source/oooimprovement/BUILD.bazel b/main/extensions/source/oooimprovement/BUILD.bazel
index 4552c375d8..c2b0821fdc 100644
--- a/main/extensions/source/oooimprovement/BUILD.bazel
+++ b/main/extensions/source/oooimprovement/BUILD.bazel
@@ -20,7 +20,6 @@ cc_binary(
     defines = [
         "WNT", "GUI", "WIN32",
         "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-        "CPPU_ENV=msci", 
         "FULL_DESK", "SHAREDLIB", "_DLL_",
         "snprintf=_snprintf",
         "snwprintf=_snwprintf",
diff --git a/main/i18npool/pool/BUILD.bazel b/main/i18npool/pool/BUILD.bazel
index 25de05c545..af81b0d0d0 100644
--- a/main/i18npool/pool/BUILD.bazel
+++ b/main/i18npool/pool/BUILD.bazel
@@ -7,7 +7,6 @@ load("//main/i18npool:breakiter_pipeline.bzl", "breakiter_data")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "I18NPOOL_DLLIMPLEMENTATION",


(openoffice) 14/20: build/win64: CPPU_ENV global + bridge alias + x64 staging wiring [P5]

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 285dc532fbf31ff8162b82d77eb84f08e0f5ec44
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Fri Jul 24 12:04:59 2026 +0200

    build/win64: CPPU_ENV global + bridge alias + x64 staging wiring [P5]
    
    Inject CPPU_ENV via the toolchain arch_defines (x86 msci / x64 mscx) and
    strip the per-module "CPPU_ENV=msci" literal from 93 BUILD files -- same
    lever as P2's _X86_/INTEL.  The env name (cppu lbnames.h) selects the
    C++/UNO bridge DLL each module loads at runtime; the hardcoded msci made
    every x64 UNO DLL/tool request msci_uno.dll (mismatch surfaced as
    "cannot get uno environments!" once i18npool's saxparser exec tool ran).
    
    Add //main/bridges:cpp_uno_bridge, an arch-selecting alias (mscx on x64,
    msci on x86, resolved in the consumer's config), so exec-config codegen
    tools (i18npool saxparser) never pull the x86-only msci_uno into the x64
    exec config; stage the bridge under its real basename in
    localedata_pipeline.
    
    Staging: select() the runtime bridge (mscx/msci) plus an amd64 CRT
    application manifest (soffice.exe/bin.manifest) on x64 -- an x86
    processorArchitecture manifest is rejected against the amd64 msvcr90.
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit b724bcdaf3285da573804956eaa3bed34a0c5ab2)
---
 build/rules/localedata_pipeline.bzl          | 18 ++++++++++++++----
 build/toolchain/BUILD.bazel                  | 12 ++++++++++--
 main/UnoControls/BUILD.bazel                 |  1 -
 main/accessibility/BUILD.bazel               |  1 -
 main/animations/BUILD.bazel                  |  1 -
 main/avmedia/BUILD.bazel                     |  1 -
 main/basctl/BUILD.bazel                      |  1 -
 main/basebmp/BUILD.bazel                     |  1 -
 main/basegfx/BUILD.bazel                     |  1 -
 main/basic/BUILD.bazel                       |  1 -
 main/binaryurp/BUILD.bazel                   |  1 -
 main/bridges/BUILD.bazel                     | 16 +++++++++++++++-
 main/canvas/BUILD.bazel                      |  1 -
 main/chart2/BUILD.bazel                      |  1 -
 main/codemaker/BUILD.bazel                   |  1 -
 main/comphelper/BUILD.bazel                  |  1 -
 main/configmgr/BUILD.bazel                   |  1 -
 main/connectivity/BUILD.bazel                |  1 -
 main/cppcanvas/BUILD.bazel                   |  1 -
 main/cppu/BUILD.bazel                        |  1 -
 main/cppuhelper/BUILD.bazel                  |  1 -
 main/cpputools/BUILD.bazel                   |  1 -
 main/cui/BUILD.bazel                         |  1 -
 main/dbaccess/BUILD.bazel                    |  1 -
 main/desktop/BUILD.bazel                     |  7 ++++++-
 main/desktop/util/amd64/soffice.exe.manifest | 15 +++++++++++++++
 main/drawinglayer/BUILD.bazel                |  1 -
 main/dtrans/BUILD.bazel                      |  1 -
 main/editeng/BUILD.bazel                     |  1 -
 main/embeddedobj/BUILD.bazel                 |  1 -
 main/embedserv/BUILD.bazel                   |  1 -
 main/eventattacher/BUILD.bazel               |  1 -
 main/extensions/BUILD.bazel                  |  1 -
 main/fileaccess/BUILD.bazel                  |  1 -
 main/filter/BUILD.bazel                      |  1 -
 main/forms/BUILD.bazel                       |  1 -
 main/formula/BUILD.bazel                     |  1 -
 main/fpicker/BUILD.bazel                     |  1 -
 main/framework/BUILD.bazel                   |  1 -
 main/i18npool/BUILD.bazel                    |  1 -
 main/i18nutil/BUILD.bazel                    |  1 -
 main/idl/BUILD.bazel                         |  1 -
 main/idlc/BUILD.bazel                        |  1 -
 main/io/BUILD.bazel                          |  1 -
 main/javaunohelper/BUILD.bazel               |  1 -
 main/jvmaccess/BUILD.bazel                   |  1 -
 main/jvmfwk/BUILD.bazel                      |  1 -
 main/l10ntools/BUILD.bazel                   |  1 -
 main/lingucomponent/BUILD.bazel              |  1 -
 main/linguistic/BUILD.bazel                  |  1 -
 main/mysqlc/BUILD.bazel                      |  1 -
 main/oox/BUILD.bazel                         |  1 -
 main/package/BUILD.bazel                     |  1 -
 main/pyuno/BUILD.bazel                       |  1 -
 main/rdbmaker/BUILD.bazel                    |  1 -
 main/registry/BUILD.bazel                    |  1 -
 main/remotebridges/BUILD.bazel               |  1 -
 main/reportdesign/BUILD.bazel                |  1 -
 main/rsc/BUILD.bazel                         |  1 -
 main/sal/BUILD.bazel                         |  1 -
 main/salhelper/BUILD.bazel                   |  1 -
 main/sax/BUILD.bazel                         |  1 -
 main/sc/BUILD.bazel                          |  1 -
 main/scaddins/BUILD.bazel                    |  1 -
 main/sccomp/BUILD.bazel                      |  1 -
 main/scripting/BUILD.bazel                   |  1 -
 main/sd/BUILD.bazel                          |  1 -
 main/sdext/BUILD.bazel                       |  1 -
 main/sfx2/BUILD.bazel                        |  1 -
 main/shell/BUILD.bazel                       |  1 -
 main/slideshow/BUILD.bazel                   |  1 -
 main/sot/BUILD.bazel                         |  1 -
 main/staging/BUILD.bazel                     | 14 ++++++++++++--
 main/starmath/BUILD.bazel                    |  1 -
 main/stoc/BUILD.bazel                        |  1 -
 main/store/BUILD.bazel                       |  1 -
 main/svgio/BUILD.bazel                       |  1 -
 main/svl/BUILD.bazel                         |  1 -
 main/svtools/BUILD.bazel                     |  1 -
 main/svx/BUILD.bazel                         |  1 -
 main/sw/BUILD.bazel                          |  1 -
 main/test/BUILD.bazel                        |  1 -
 main/toolkit/BUILD.bazel                     |  1 -
 main/tools/BUILD.bazel                       |  2 --
 main/ucb/BUILD.bazel                         |  1 -
 main/ucbhelper/BUILD.bazel                   |  1 -
 main/unotools/BUILD.bazel                    |  1 -
 main/unoxml/BUILD.bazel                      |  1 -
 main/uui/BUILD.bazel                         |  1 -
 main/vbahelper/BUILD.bazel                   |  1 -
 main/vcl/BUILD.bazel                         |  1 -
 main/winaccessibility/BUILD.bazel            |  1 -
 main/writerfilter/BUILD.bazel                |  1 -
 main/xmlhelp/BUILD.bazel                     |  1 -
 main/xmloff/BUILD.bazel                      |  1 -
 main/xmlreader/BUILD.bazel                   |  1 -
 main/xmlscript/BUILD.bazel                   |  1 -
 main/xmlsecurity/BUILD.bazel                 |  1 -
 98 files changed, 72 insertions(+), 103 deletions(-)

diff --git a/build/rules/localedata_pipeline.bzl b/build/rules/localedata_pipeline.bzl
index cac14b7f83..5d54832ecc 100644
--- a/build/rules/localedata_pipeline.bzl
+++ b/build/rules/localedata_pipeline.bzl
@@ -46,11 +46,14 @@ _DLL_RENAME = [
     # bootstrap.uno's simpleregistry/textualservices parses the XML components
     # rdb via xmlreader.dll.
     ("_xmlreader_dll",  "xmlreader.dll"),
-    # Binary UNO bridge (msci C++ <=> UNO) — loaded by name to map interfaces
-    # across the saxparser <-> expwrap component boundary.
-    ("_msci_uno_dll",   "msci_uno.dll"),
 ]
 
+# Binary UNO bridge (C++ <=> UNO) — loaded by name (msci_uno.dll on x86,
+# mscx_uno.dll on x64) to map interfaces across the saxparser <-> expwrap
+# component boundary.  Staged under its real basename so the arch-selected DLL
+# keeps its own name (the name saxparser's CPPU_ENV asks the loader for).
+_BRIDGE_ATTR = "_cpp_uno_bridge"
+
 def _localedata_gen_impl(ctx):
     saxparser    = ctx.executable._saxparser
     # services_rdb emits both the .rdb and its .input list; keep the .rdb only.
@@ -69,6 +72,9 @@ def _localedata_gen_impl(ctx):
     for attr, runtime in _DLL_RENAME:
         rename[getattr(ctx.file, attr)] = runtime
     dll_files = [getattr(ctx.file, attr) for attr, _ in _DLL_RENAME]
+    # C++/UNO bridge: stage under its real basename (msci_uno.dll / mscx_uno.dll).
+    bridge_dll = getattr(ctx.file, _BRIDGE_ATTR)
+    dll_files.append(bridge_dll)
 
     # ── Stage saxparser.exe + DLLs + CRT into one flat tools dir ──────────────
     all_to_stage = [saxparser] + dll_files + crt_files
@@ -153,7 +159,11 @@ localedata_gen = rule(
         "_expwrap_dll":    attr.label(default = "//main/sax:expwrap",              allow_single_file = True, cfg = "exec"),
         "_bootstrap_uno":  attr.label(default = "//main/stoc:bootstrap.uno",       allow_single_file = True, cfg = "exec"),
         "_xmlreader_dll":  attr.label(default = "//main/xmlreader:xmlreader",       allow_single_file = True, cfg = "exec"),
-        "_msci_uno_dll":   attr.label(default = "//main/bridges:msci_uno",          allow_single_file = True, cfg = "exec"),
+        # C++/UNO bridge, cfg="exec" (built for the x64 host).  The alias selects
+        # msci_uno.dll (x86) / mscx_uno.dll (x64) in the exec config — so on this
+        # x64 host it resolves mscx_uno and never pulls the x86-only msci_uno into
+        # the exec config.  Staged under its real basename (see _DLL_RENAME).
+        "_cpp_uno_bridge": attr.label(default = "//main/bridges:cpp_uno_bridge",     allow_single_file = True, cfg = "exec"),
         "_crt_dlls": attr.label(
             default = "//main/external/msvcp90:msvcp90",
             allow_files = True,
diff --git a/build/toolchain/BUILD.bazel b/build/toolchain/BUILD.bazel
index 76c8cd8601..19fc963dd0 100644
--- a/build/toolchain/BUILD.bazel
+++ b/build/toolchain/BUILD.bazel
@@ -81,7 +81,11 @@ cc_toolchain_config(
     default_link_flags     = ["/MACHINE:X86"],
     # Per-arch CPU defines injected globally (Win64 Phase 2) so no module BUILD
     # carries an arch flag.  x86 → _X86_=1, INTEL.  WIN32 stays in the modules.
-    arch_defines           = ["_X86_=1", "INTEL"],
+    # CPPU_ENV (the C++/UNO environment name — lbnames.h picks the bridge DLL:
+    # msci_uno.dll here) is arch-dependent exactly like _X86_/_AMD64_, so it is
+    # injected globally too (mirrors solenv wntmsci*.mk); the per-module
+    # CPPU_ENV=msci literals were stripped (would override this on x64).
+    arch_defines           = ["_X86_=1", "INTEL", "CPPU_ENV=msci"],
     dbg_mode_debug_flag      = "",   # /Z7 embeds debug info in objects at compile; linker PDB (/DEBUG via --features=generate_pdb) uses the per-action mspdbsrv wrapper above for parallel links
     fastbuild_mode_debug_flag = "",  # same — /Z7 embeds, no compile-time PDB
     supports_parse_showincludes = False,
@@ -195,7 +199,11 @@ cc_toolchain_config(
     default_link_flags     = ["/MACHINE:X64"],
     # Per-arch CPU defines injected globally (Win64 Phase 2).  x64 → _AMD64_=1,
     # X86_64.  WIN32 stays in the modules; the x64 compiler auto-defines _WIN64.
-    arch_defines           = ["_AMD64_=1", "X86_64"],
+    # CPPU_ENV=mscx is the x64 C++/UNO environment name (lbnames.h → loads
+    # mscx_uno.dll); injected globally like the CPU defines so every UNO DLL/tool
+    # in the x64 build requests the mscx bridge consistently (the per-module
+    # CPPU_ENV=msci literals were stripped so they can't override this).
+    arch_defines           = ["_AMD64_=1", "X86_64", "CPPU_ENV=mscx"],
     # ml64 rejects the x86 /coff and /Cx flags — assemble with /c only.
     masm_flags             = ["/c"],
     # x64 has no SafeSEH — drop /SAFESEH:NO from the generate_pdb link.
diff --git a/main/UnoControls/BUILD.bazel b/main/UnoControls/BUILD.bazel
index f3d4fc4a8b..b60e041fef 100644
--- a/main/UnoControls/BUILD.bazel
+++ b/main/UnoControls/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/accessibility/BUILD.bazel b/main/accessibility/BUILD.bazel
index eef4336722..4f7a01b40f 100644
--- a/main/accessibility/BUILD.bazel
+++ b/main/accessibility/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "ACCESSIBILITY_DLLIMPLEMENTATION",
diff --git a/main/animations/BUILD.bazel b/main/animations/BUILD.bazel
index 9c438eaa8d..0ec76bb370 100644
--- a/main/animations/BUILD.bazel
+++ b/main/animations/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/avmedia/BUILD.bazel b/main/avmedia/BUILD.bazel
index ea72c76789..66e5d1c54e 100644
--- a/main/avmedia/BUILD.bazel
+++ b/main/avmedia/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/basctl/BUILD.bazel b/main/basctl/BUILD.bazel
index 63af557944..f0ff782935 100644
--- a/main/basctl/BUILD.bazel
+++ b/main/basctl/BUILD.bazel
@@ -7,7 +7,6 @@ load("//build/rules:sdi_target.bzl", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "SUPD=680",
diff --git a/main/basebmp/BUILD.bazel b/main/basebmp/BUILD.bazel
index 08ba7d042e..87220255c1 100644
--- a/main/basebmp/BUILD.bazel
+++ b/main/basebmp/BUILD.bazel
@@ -3,7 +3,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "BASEBMP_DLLIMPLEMENTATION",
diff --git a/main/basegfx/BUILD.bazel b/main/basegfx/BUILD.bazel
index d047db8d6d..dc7cc021d0 100644
--- a/main/basegfx/BUILD.bazel
+++ b/main/basegfx/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "BASEGFX_DLLIMPLEMENTATION",
diff --git a/main/basic/BUILD.bazel b/main/basic/BUILD.bazel
index 3f11f1978c..f4701e57d4 100644
--- a/main/basic/BUILD.bazel
+++ b/main/basic/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/binaryurp/BUILD.bazel b/main/binaryurp/BUILD.bazel
index 5022b59ac3..200abefe66 100644
--- a/main/binaryurp/BUILD.bazel
+++ b/main/binaryurp/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/bridges/BUILD.bazel b/main/bridges/BUILD.bazel
index e9ed08c788..4c4a83cea1 100644
--- a/main/bridges/BUILD.bazel
+++ b/main/bridges/BUILD.bazel
@@ -19,7 +19,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     # Needed by vtablefactory.cxx for the Windows code path
     "LEAK_STATIC_DATA",
@@ -172,6 +171,21 @@ filegroup(
     visibility = ["//visibility:public"],
 )
 
+# ── cpp_uno_bridge — arch-selecting alias for the C++/UNO bridge DLL ──────────
+# Resolves to msci_uno.dll (x86) or mscx_uno.dll (x64) IN THE CONSUMER'S CONFIG.
+# This is what exec-config codegen tools (e.g. i18npool saxparser) depend on: the
+# select keys off the exec platform (x86_64 host), so it picks the compatible
+# mscx_uno and never pulls the x86-only msci_uno into an x64 exec config.  Runtime
+# staging (target config) can also use it instead of a hand-written select().
+alias(
+    name = "cpp_uno_bridge",
+    actual = select({
+        "//build:arch_x64": ":mscx_uno",
+        "//conditions:default": ":msci_uno",
+    }),
+    visibility = ["//visibility:public"],
+)
+
 # ── java_uno bridge (Java↔C++ UNO bridge) ────────────────────────────────
 # Two cooperating artifacts:
 #   • java_uno.dll  — native JNI bridge (this cc_binary)
diff --git a/main/canvas/BUILD.bazel b/main/canvas/BUILD.bazel
index 5602bd1cb5..c5168b182b 100644
--- a/main/canvas/BUILD.bazel
+++ b/main/canvas/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/chart2/BUILD.bazel b/main/chart2/BUILD.bazel
index 59d574819e..5d6de66d1a 100644
--- a/main/chart2/BUILD.bazel
+++ b/main/chart2/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rename_file", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/codemaker/BUILD.bazel b/main/codemaker/BUILD.bazel
index 0690824abd..e653659218 100644
--- a/main/codemaker/BUILD.bazel
+++ b/main/codemaker/BUILD.bazel
@@ -11,7 +11,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/comphelper/BUILD.bazel b/main/comphelper/BUILD.bazel
index 4c6fc29291..cd188f0fa1 100644
--- a/main/comphelper/BUILD.bazel
+++ b/main/comphelper/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:gtest_test.bzl", "gtest_test")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "COMPHELPER_DLLIMPLEMENTATION",
diff --git a/main/configmgr/BUILD.bazel b/main/configmgr/BUILD.bazel
index 977d76921b..a2f120cc91 100644
--- a/main/configmgr/BUILD.bazel
+++ b/main/configmgr/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/connectivity/BUILD.bazel b/main/connectivity/BUILD.bazel
index efe38df92c..41c43cc9ba 100644
--- a/main/connectivity/BUILD.bazel
+++ b/main/connectivity/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/cppcanvas/BUILD.bazel b/main/cppcanvas/BUILD.bazel
index de4771d7ed..2638dd41eb 100644
--- a/main/cppcanvas/BUILD.bazel
+++ b/main/cppcanvas/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/cppu/BUILD.bazel b/main/cppu/BUILD.bazel
index 8d9cd217cb..a210cae309 100644
--- a/main/cppu/BUILD.bazel
+++ b/main/cppu/BUILD.bazel
@@ -14,7 +14,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/cppuhelper/BUILD.bazel b/main/cppuhelper/BUILD.bazel
index 15b32d4614..4cab9c74fa 100644
--- a/main/cppuhelper/BUILD.bazel
+++ b/main/cppuhelper/BUILD.bazel
@@ -15,7 +15,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/cpputools/BUILD.bazel b/main/cpputools/BUILD.bazel
index 36544449b6..dd4ccd5537 100644
--- a/main/cpputools/BUILD.bazel
+++ b/main/cpputools/BUILD.bazel
@@ -3,7 +3,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/cui/BUILD.bazel b/main/cui/BUILD.bazel
index 79f4a663ee..6a4a394887 100644
--- a/main/cui/BUILD.bazel
+++ b/main/cui/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "SUPD=680",
diff --git a/main/dbaccess/BUILD.bazel b/main/dbaccess/BUILD.bazel
index e727afaf86..f8c7d1efd8 100644
--- a/main/dbaccess/BUILD.bazel
+++ b/main/dbaccess/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rename_file", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/desktop/BUILD.bazel b/main/desktop/BUILD.bazel
index 976c15248a..1f96cab28d 100644
--- a/main/desktop/BUILD.bazel
+++ b/main/desktop/BUILD.bazel
@@ -7,7 +7,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
@@ -1146,4 +1145,10 @@ rsc_res(
 
 exports_files(glob(["**/*.component"]))
 exports_files(["util/soffice.exe.manifest", "util/soffice.bin.manifest"])
+# amd64 (x64) release app manifest — same as util/soffice.exe.manifest but with
+# processorArchitecture="amd64" in the assemblyIdentity + Microsoft.VC90.CRT /
+# Common-Controls deps.  On x64 the loader rejects an x86 CRT manifest against
+# the amd64 msvcr90.dll (see project_win64_source_fixes #4), so staging selects
+# this variant.  Same basename so it still stages as soffice.exe/bin.manifest.
+exports_files(["util/amd64/soffice.exe.manifest"])
 
diff --git a/main/desktop/util/amd64/soffice.exe.manifest b/main/desktop/util/amd64/soffice.exe.manifest
new file mode 100644
index 0000000000..f0498fb410
--- /dev/null
+++ b/main/desktop/util/amd64/soffice.exe.manifest
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+  <assemblyIdentity version="1.0.0.0" processorArchitecture="amd64" name="OpenOffice" type="win32" />
+  <description>http://www.openoffice.org</description>
+  <dependency>
+    <dependentAssembly>
+      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="amd64"/>
+    </dependentAssembly>
+  </dependency>
+  <dependency>
+    <dependentAssembly>
+      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30729.1" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b"/>
+    </dependentAssembly>
+  </dependency>
+</assembly>
diff --git a/main/drawinglayer/BUILD.bazel b/main/drawinglayer/BUILD.bazel
index 639630532b..9df6794120 100644
--- a/main/drawinglayer/BUILD.bazel
+++ b/main/drawinglayer/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/dtrans/BUILD.bazel b/main/dtrans/BUILD.bazel
index f49fc35c73..3b6c77e2c0 100644
--- a/main/dtrans/BUILD.bazel
+++ b/main/dtrans/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
 ]
 
diff --git a/main/editeng/BUILD.bazel b/main/editeng/BUILD.bazel
index 8ee31a4651..42514b19ed 100644
--- a/main/editeng/BUILD.bazel
+++ b/main/editeng/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/embeddedobj/BUILD.bazel b/main/embeddedobj/BUILD.bazel
index a80056765c..59726208f6 100644
--- a/main/embeddedobj/BUILD.bazel
+++ b/main/embeddedobj/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/embedserv/BUILD.bazel b/main/embedserv/BUILD.bazel
index 99386e9cab..6915f7c234 100644
--- a/main/embedserv/BUILD.bazel
+++ b/main/embedserv/BUILD.bazel
@@ -16,7 +16,6 @@ _ATL_REQUIRED = select({
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/eventattacher/BUILD.bazel b/main/eventattacher/BUILD.bazel
index 88d3b3c4cc..732e2af9bb 100644
--- a/main/eventattacher/BUILD.bazel
+++ b/main/eventattacher/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/extensions/BUILD.bazel b/main/extensions/BUILD.bazel
index 2e31ad3c25..99d2d7571c 100644
--- a/main/extensions/BUILD.bazel
+++ b/main/extensions/BUILD.bazel
@@ -30,7 +30,6 @@ filegroup(
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/fileaccess/BUILD.bazel b/main/fileaccess/BUILD.bazel
index 3e6f3a7c78..d21e6a9ceb 100644
--- a/main/fileaccess/BUILD.bazel
+++ b/main/fileaccess/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "FILEACCESS_DLLIMPLEMENTATION",
diff --git a/main/filter/BUILD.bazel b/main/filter/BUILD.bazel
index 7006f0f478..c6d88e296d 100644
--- a/main/filter/BUILD.bazel
+++ b/main/filter/BUILD.bazel
@@ -7,7 +7,6 @@ load("//main/filter:filter_rules.bzl", "FILTER_COPTS", "FILTER_HDR_DEPS", "graph
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/forms/BUILD.bazel b/main/forms/BUILD.bazel
index 5b9981004d..f16531f2af 100644
--- a/main/forms/BUILD.bazel
+++ b/main/forms/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/formula/BUILD.bazel b/main/formula/BUILD.bazel
index 790efc230a..2b2ebbb86b 100644
--- a/main/formula/BUILD.bazel
+++ b/main/formula/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/fpicker/BUILD.bazel b/main/fpicker/BUILD.bazel
index bf5de2a007..5511159628 100644
--- a/main/fpicker/BUILD.bazel
+++ b/main/fpicker/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
 ]
 
diff --git a/main/framework/BUILD.bazel b/main/framework/BUILD.bazel
index a77a229f9c..4dc6dbb126 100644
--- a/main/framework/BUILD.bazel
+++ b/main/framework/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/i18npool/BUILD.bazel b/main/i18npool/BUILD.bazel
index de215f5543..ab34362ce8 100644
--- a/main/i18npool/BUILD.bazel
+++ b/main/i18npool/BUILD.bazel
@@ -7,7 +7,6 @@ load("//build/rules:localedata_pipeline.bzl", "localedata_gen")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "I18NPOOL_DLLIMPLEMENTATION",
diff --git a/main/i18nutil/BUILD.bazel b/main/i18nutil/BUILD.bazel
index d2c867ca37..b7080d7a3a 100644
--- a/main/i18nutil/BUILD.bazel
+++ b/main/i18nutil/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "I18NUTIL_DLLIMPLEMENTATION",
diff --git a/main/idl/BUILD.bazel b/main/idl/BUILD.bazel
index 1c6c2dc8b5..5eda904d3d 100644
--- a/main/idl/BUILD.bazel
+++ b/main/idl/BUILD.bazel
@@ -4,7 +4,6 @@ load("//build/rules:sdi_target.bzl", "svidl_bundle")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "snprintf=_snprintf",
     "IDL_COMPILER",
 ]
diff --git a/main/idlc/BUILD.bazel b/main/idlc/BUILD.bazel
index 51e77991d6..aef6218ee5 100644
--- a/main/idlc/BUILD.bazel
+++ b/main/idlc/BUILD.bazel
@@ -16,7 +16,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/io/BUILD.bazel b/main/io/BUILD.bazel
index 009fabfe32..5a0028b366 100644
--- a/main/io/BUILD.bazel
+++ b/main/io/BUILD.bazel
@@ -15,7 +15,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/javaunohelper/BUILD.bazel b/main/javaunohelper/BUILD.bazel
index 62b5034c6f..2281c9ec49 100644
--- a/main/javaunohelper/BUILD.bazel
+++ b/main/javaunohelper/BUILD.bazel
@@ -14,7 +14,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "SHAREDLIB", "_DLL_",
     "SOLAR_JAVA",
 ]
diff --git a/main/jvmaccess/BUILD.bazel b/main/jvmaccess/BUILD.bazel
index cde6c14b02..61dc53faf3 100644
--- a/main/jvmaccess/BUILD.bazel
+++ b/main/jvmaccess/BUILD.bazel
@@ -11,7 +11,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "SOLAR_JAVA",
diff --git a/main/jvmfwk/BUILD.bazel b/main/jvmfwk/BUILD.bazel
index 394f6024f8..7a3f29ba91 100644
--- a/main/jvmfwk/BUILD.bazel
+++ b/main/jvmfwk/BUILD.bazel
@@ -17,7 +17,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "JVMFWK_DLLIMPLEMENTATION",
diff --git a/main/l10ntools/BUILD.bazel b/main/l10ntools/BUILD.bazel
index 698d33b174..0a4c70da47 100644
--- a/main/l10ntools/BUILD.bazel
+++ b/main/l10ntools/BUILD.bazel
@@ -9,7 +9,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "snprintf=_snprintf",
     "YY_NEVER_INTERACTIVE=1",   # suppress flex interactive-mode check
diff --git a/main/lingucomponent/BUILD.bazel b/main/lingucomponent/BUILD.bazel
index d826ee57e7..1eef5615d5 100644
--- a/main/lingucomponent/BUILD.bazel
+++ b/main/lingucomponent/BUILD.bazel
@@ -7,7 +7,6 @@ _DEFINES = [
     "GUI",
     "WIN32",
     "_WINDOWS",
-    "CPPU_ENV=msci",
     "snprintf=_snprintf",
     "SUPD=680",
 ]
diff --git a/main/linguistic/BUILD.bazel b/main/linguistic/BUILD.bazel
index 9b21c55f35..6a53ef672f 100644
--- a/main/linguistic/BUILD.bazel
+++ b/main/linguistic/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/mysqlc/BUILD.bazel b/main/mysqlc/BUILD.bazel
index 8d297380b6..6b7d8ef8bb 100644
--- a/main/mysqlc/BUILD.bazel
+++ b/main/mysqlc/BUILD.bazel
@@ -10,7 +10,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "SUPD=680",
diff --git a/main/oox/BUILD.bazel b/main/oox/BUILD.bazel
index 5034bdcc02..db226abe37 100644
--- a/main/oox/BUILD.bazel
+++ b/main/oox/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/package/BUILD.bazel b/main/package/BUILD.bazel
index 6cae000e1b..b261a204e6 100644
--- a/main/package/BUILD.bazel
+++ b/main/package/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "PACKAGE_DLLIMPLEMENTATION",
diff --git a/main/pyuno/BUILD.bazel b/main/pyuno/BUILD.bazel
index 76d8131009..8fa9924547 100644
--- a/main/pyuno/BUILD.bazel
+++ b/main/pyuno/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/rdbmaker/BUILD.bazel b/main/rdbmaker/BUILD.bazel
index d7e335013d..df853100ba 100644
--- a/main/rdbmaker/BUILD.bazel
+++ b/main/rdbmaker/BUILD.bazel
@@ -14,7 +14,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/registry/BUILD.bazel b/main/registry/BUILD.bazel
index d52ce725f4..7d678858da 100644
--- a/main/registry/BUILD.bazel
+++ b/main/registry/BUILD.bazel
@@ -12,7 +12,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/remotebridges/BUILD.bazel b/main/remotebridges/BUILD.bazel
index 54ebea9607..ce1ccb360a 100644
--- a/main/remotebridges/BUILD.bazel
+++ b/main/remotebridges/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/reportdesign/BUILD.bazel b/main/reportdesign/BUILD.bazel
index c734a8e09f..10afb43f31 100644
--- a/main/reportdesign/BUILD.bazel
+++ b/main/reportdesign/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "REPORTDESIGN_DLLIMPLEMENTATION",
diff --git a/main/rsc/BUILD.bazel b/main/rsc/BUILD.bazel
index bdf20e9c69..5c9bf6a379 100644
--- a/main/rsc/BUILD.bazel
+++ b/main/rsc/BUILD.bazel
@@ -13,7 +13,6 @@ cc_library(
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "snprintf=_snprintf",
 ]
diff --git a/main/sal/BUILD.bazel b/main/sal/BUILD.bazel
index bb7255e3a6..f471f2f380 100644
--- a/main/sal/BUILD.bazel
+++ b/main/sal/BUILD.bazel
@@ -15,7 +15,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/salhelper/BUILD.bazel b/main/salhelper/BUILD.bazel
index b9770a4d30..c18e6218aa 100644
--- a/main/salhelper/BUILD.bazel
+++ b/main/salhelper/BUILD.bazel
@@ -12,7 +12,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/sax/BUILD.bazel b/main/sax/BUILD.bazel
index c4edef0901..bcb30ed4d6 100644
--- a/main/sax/BUILD.bazel
+++ b/main/sax/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:gtest_test.bzl", "gtest_test")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/sc/BUILD.bazel b/main/sc/BUILD.bazel
index b05addfe4a..2623ee76fb 100644
--- a/main/sc/BUILD.bazel
+++ b/main/sc/BUILD.bazel
@@ -7,7 +7,6 @@ load("//build/rules:sdi_target.bzl", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/scaddins/BUILD.bazel b/main/scaddins/BUILD.bazel
index d00a0d1037..9cd2fb02bf 100644
--- a/main/scaddins/BUILD.bazel
+++ b/main/scaddins/BUILD.bazel
@@ -7,7 +7,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "SUPD=680",
diff --git a/main/sccomp/BUILD.bazel b/main/sccomp/BUILD.bazel
index 36f07d3a45..38b5ecf955 100644
--- a/main/sccomp/BUILD.bazel
+++ b/main/sccomp/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "SUPD=680",
diff --git a/main/scripting/BUILD.bazel b/main/scripting/BUILD.bazel
index 8bb262450d..8ceb3e20fc 100644
--- a/main/scripting/BUILD.bazel
+++ b/main/scripting/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/sd/BUILD.bazel b/main/sd/BUILD.bazel
index 31dce90a68..097e04782c 100644
--- a/main/sd/BUILD.bazel
+++ b/main/sd/BUILD.bazel
@@ -7,7 +7,6 @@ load("//build/rules:sdi_target.bzl", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/sdext/BUILD.bazel b/main/sdext/BUILD.bazel
index 61dad4adc2..86b40380d2 100644
--- a/main/sdext/BUILD.bazel
+++ b/main/sdext/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/sfx2/BUILD.bazel b/main/sfx2/BUILD.bazel
index 5003b4fb42..43df0687f3 100644
--- a/main/sfx2/BUILD.bazel
+++ b/main/sfx2/BUILD.bazel
@@ -7,7 +7,6 @@ load("//build/rules:sdi_target.bzl", "sdi_package", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/shell/BUILD.bazel b/main/shell/BUILD.bazel
index 0e999bec7c..2c7055de0d 100644
--- a/main/shell/BUILD.bazel
+++ b/main/shell/BUILD.bazel
@@ -38,7 +38,6 @@ _SHLXT_COPTS = [
 _UNO_DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
diff --git a/main/slideshow/BUILD.bazel b/main/slideshow/BUILD.bazel
index ce9fe9f193..020c8e8afa 100644
--- a/main/slideshow/BUILD.bazel
+++ b/main/slideshow/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/sot/BUILD.bazel b/main/sot/BUILD.bazel
index 1e669c7c3e..bd556bb3e7 100644
--- a/main/sot/BUILD.bazel
+++ b/main/sot/BUILD.bazel
@@ -3,7 +3,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "SOT_DLLIMPLEMENTATION",
diff --git a/main/staging/BUILD.bazel b/main/staging/BUILD.bazel
index 5cd65a96bd..615c7956df 100644
--- a/main/staging/BUILD.bazel
+++ b/main/staging/BUILD.bazel
@@ -41,7 +41,12 @@ filegroup(
 # collect_outputs.deps does not accept raw source files.
 filegroup(
     name = "soffice_app_manifest",
-    srcs = ["//main/desktop:util/soffice.exe.manifest"],
+    srcs = select({
+        # x64 needs an amd64 CRT/assembly manifest — the loader rejects an x86
+        # processorArchitecture manifest against the amd64 msvcr90.dll (0xC000007B).
+        "//build:arch_x64": ["//main/desktop:util/amd64/soffice.exe.manifest"],
+        "//conditions:default": ["//main/desktop:util/soffice.exe.manifest"],
+    }),
 )
 
 # ── Flat program/ files (DLLs, EXEs, RDBs, ZIPs, .py scripts, .ini) ─────────
@@ -71,7 +76,6 @@ collect_outputs(
         "//main/stoc:namingservice.uno",
         "//main/stoc:proxyfac.uno",
         "//main/binaryurp:binaryurp",
-        "//main/bridges:msci_uno",
         # Native JNI bridge (java_uno.dll). Loaded by jurt's NativeThreadPool via
         # System.loadLibrary("java_uno") once Java is enabled. The Java side
         # (java_uno.jar) needs the program/classes/ classpath staging, which does
@@ -368,6 +372,12 @@ collect_outputs(
         "//conditions:default": [
             ":soffice_app_manifest",
         ],
+    }) + select({
+        # C++/UNO bridge, loaded by name from CPPU_ENV: msci_uno.dll on x86,
+        # mscx_uno.dll on x64.  Each target is target_compatible_with its own
+        # arch, so the unused one must not appear in the other arch's deps.
+        "//build:arch_x64": ["//main/bridges:mscx_uno"],
+        "//conditions:default": ["//main/bridges:msci_uno"],
     }),
 )
 
diff --git a/main/starmath/BUILD.bazel b/main/starmath/BUILD.bazel
index 08b9efe50a..02a71517c3 100644
--- a/main/starmath/BUILD.bazel
+++ b/main/starmath/BUILD.bazel
@@ -7,7 +7,6 @@ load("//build/rules:sdi_target.bzl", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/stoc/BUILD.bazel b/main/stoc/BUILD.bazel
index f9478655a6..14998bc85e 100644
--- a/main/stoc/BUILD.bazel
+++ b/main/stoc/BUILD.bazel
@@ -18,7 +18,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/store/BUILD.bazel b/main/store/BUILD.bazel
index 5c8d8f2042..9999eabb50 100644
--- a/main/store/BUILD.bazel
+++ b/main/store/BUILD.bazel
@@ -12,7 +12,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/svgio/BUILD.bazel b/main/svgio/BUILD.bazel
index d2113e5e2e..73f4b259a5 100644
--- a/main/svgio/BUILD.bazel
+++ b/main/svgio/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/svl/BUILD.bazel b/main/svl/BUILD.bazel
index 376a2d005c..e6c39278f1 100644
--- a/main/svl/BUILD.bazel
+++ b/main/svl/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/svtools/BUILD.bazel b/main/svtools/BUILD.bazel
index 3e0fe4ea95..0dce111fa1 100644
--- a/main/svtools/BUILD.bazel
+++ b/main/svtools/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "_HAS_ITERATOR_DEBUGGING=0",
diff --git a/main/svx/BUILD.bazel b/main/svx/BUILD.bazel
index 729072a18e..29cb72bc25 100644
--- a/main/svx/BUILD.bazel
+++ b/main/svx/BUILD.bazel
@@ -7,7 +7,6 @@ load("//build/rules:sdi_target.bzl", "sdi_package", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/sw/BUILD.bazel b/main/sw/BUILD.bazel
index 29cd183efb..cb8d873536 100644
--- a/main/sw/BUILD.bazel
+++ b/main/sw/BUILD.bazel
@@ -7,7 +7,6 @@ load("//build/rules:sdi_target.bzl", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/test/BUILD.bazel b/main/test/BUILD.bazel
index fb1f1f06ff..0eb2079979 100644
--- a/main/test/BUILD.bazel
+++ b/main/test/BUILD.bazel
@@ -13,7 +13,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "SHAREDLIB", "_DLL_",
     "OOO_DLLIMPLEMENTATION_TEST",
     "snprintf=_snprintf",
diff --git a/main/toolkit/BUILD.bazel b/main/toolkit/BUILD.bazel
index 5d80d70a3a..e5b06cb0a5 100644
--- a/main/toolkit/BUILD.bazel
+++ b/main/toolkit/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/tools/BUILD.bazel b/main/tools/BUILD.bazel
index 7fe0f964a6..76b60b1862 100644
--- a/main/tools/BUILD.bazel
+++ b/main/tools/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:gtest_test.bzl", "gtest_test")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "TOOLS_DLLIMPLEMENTATION",
@@ -251,7 +250,6 @@ gtest_test(
     defines = [
         "WNT", "GUI", "WIN32",
         "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-        "CPPU_ENV=msci", 
         "snprintf=_snprintf",
     ],
     deps = [
diff --git a/main/ucb/BUILD.bazel b/main/ucb/BUILD.bazel
index 8eed1dd828..45c1cfcccc 100644
--- a/main/ucb/BUILD.bazel
+++ b/main/ucb/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/ucbhelper/BUILD.bazel b/main/ucbhelper/BUILD.bazel
index 8a752965b2..66e236a167 100644
--- a/main/ucbhelper/BUILD.bazel
+++ b/main/ucbhelper/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "UCBHELPER_DLLIMPLEMENTATION",
diff --git a/main/unotools/BUILD.bazel b/main/unotools/BUILD.bazel
index 6622bc0dd2..11b235f2e1 100644
--- a/main/unotools/BUILD.bazel
+++ b/main/unotools/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "UNOTOOLS_DLLIMPLEMENTATION",
diff --git a/main/unoxml/BUILD.bazel b/main/unoxml/BUILD.bazel
index 7e1f2e5606..36d26ecab4 100644
--- a/main/unoxml/BUILD.bazel
+++ b/main/unoxml/BUILD.bazel
@@ -3,7 +3,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/uui/BUILD.bazel b/main/uui/BUILD.bazel
index 8c8fc92333..3b26524b13 100644
--- a/main/uui/BUILD.bazel
+++ b/main/uui/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/vbahelper/BUILD.bazel b/main/vbahelper/BUILD.bazel
index 400db0f8f9..509f5bd761 100644
--- a/main/vbahelper/BUILD.bazel
+++ b/main/vbahelper/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/vcl/BUILD.bazel b/main/vcl/BUILD.bazel
index 2887a03f9c..3bcf7e3ef8 100644
--- a/main/vcl/BUILD.bazel
+++ b/main/vcl/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/winaccessibility/BUILD.bazel b/main/winaccessibility/BUILD.bazel
index 17b495bd9c..d67adc3f30 100644
--- a/main/winaccessibility/BUILD.bazel
+++ b/main/winaccessibility/BUILD.bazel
@@ -13,7 +13,6 @@ _ATL_REQUIRED = select({
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/writerfilter/BUILD.bazel b/main/writerfilter/BUILD.bazel
index 61e1c4d7a6..20a6ca71da 100644
--- a/main/writerfilter/BUILD.bazel
+++ b/main/writerfilter/BUILD.bazel
@@ -8,7 +8,6 @@ load(":ooxml_ns_rules.bzl", "OOXML_NS", "ooxml_ns_factory_rules")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/xmlhelp/BUILD.bazel b/main/xmlhelp/BUILD.bazel
index 438d14c38f..2775041fe1 100644
--- a/main/xmlhelp/BUILD.bazel
+++ b/main/xmlhelp/BUILD.bazel
@@ -16,7 +16,6 @@ exports_files(glob([
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/xmloff/BUILD.bazel b/main/xmloff/BUILD.bazel
index 8d934155e4..c80cd1c419 100644
--- a/main/xmloff/BUILD.bazel
+++ b/main/xmloff/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/xmlreader/BUILD.bazel b/main/xmlreader/BUILD.bazel
index c38b4d0445..0212a9cd42 100644
--- a/main/xmlreader/BUILD.bazel
+++ b/main/xmlreader/BUILD.bazel
@@ -12,7 +12,6 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/xmlscript/BUILD.bazel b/main/xmlscript/BUILD.bazel
index ba6338f446..59cda1d1dd 100644
--- a/main/xmlscript/BUILD.bazel
+++ b/main/xmlscript/BUILD.bazel
@@ -5,7 +5,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "XCR_DLLIMPLEMENTATION",
diff --git a/main/xmlsecurity/BUILD.bazel b/main/xmlsecurity/BUILD.bazel
index fee63d9325..2189c059df 100644
--- a/main/xmlsecurity/BUILD.bazel
+++ b/main/xmlsecurity/BUILD.bazel
@@ -6,7 +6,6 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]


(openoffice) 18/20: bridges/msvc_win64: fix the x64 C++/UNO bridge (backport origin/windows-amd64)

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 1040d136d89c8c64bf4ed2991f2779343c1f09d9
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Sat Jul 25 10:47:35 2026 +0200

    bridges/msvc_win64: fix the x64 C++/UNO bridge (backport origin/windows-amd64)
    
    The x64 bridge only linked; it was never actually exercised through a generated
    vtable snippet (the roundtrip test dispatched via uno_Interface directly), so
    several real bugs hid until soffice ran.  Adopt the validated windows-amd64
    versions of the matched set:
    
    - call.asm + cpp2uno.cxx: codeSnippet emitted bad machine-code opcodes -- 0x49
      where the mov [rsp+8],rcx / mov [rsp+16],rdx opcode must be 0x89 (0x49 is a
      stray REX prefix, decoding as "and al,8"), so the snippet never homed this/args
      and cpp_vtable_call got a garbage this (ad7f763788).  And callVirtualMethod used
      .ALLOCSTACK unwind info while adjusting rsp dynamically -> not unwindable ->
      C++/SEH exceptions could not propagate through it; the reference uses
      .SETFRAME rbp, required for a frame with dynamic stack allocation (607903dd38).
    - abi.cxx return_in_hidden_param: the >8-byte-struct case was inverted (returned
      "register" instead of "hidden memory pointer"), corrupting every struct/exception
      return larger than 8 bytes -- e.g. getAllExtensions' nested Sequences (0c2e3065a0).
    - except.cxx: our __type_info helper carried an extra _m_name field, shifting the
      mangled name off MSVC's type_info layout (offset 24 vs 16).  Exact-type catches
      match by type_info address and worked; cross-DLL BASE-class catches fall back to
      name strcmp and read the misplaced field -> catch(InteractiveIOException&) never
      matched a thrown InteractiveAugmentedIOException, so getCaughtException's rethrow
      escaped uncaught and soffice exited silently after CheckExtensionDependencies.
    
    uno2cpp.cxx / abi.hxx / dllinit.cxx / mscx.hxx were already identical to the
    reference and are unchanged.
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit 4c722fde1cbd72735e4d7bc86cb790e6719790b4)
---
 .../source/cpp_uno/msvc_win64_x86-64/abi.cxx       | 10 ++-
 .../source/cpp_uno/msvc_win64_x86-64/call.asm      | 80 ++++++++++--------
 .../source/cpp_uno/msvc_win64_x86-64/cpp2uno.cxx   | 23 ++++--
 .../source/cpp_uno/msvc_win64_x86-64/except.cxx    | 96 ++++++++++++++++++----
 4 files changed, 143 insertions(+), 66 deletions(-)

diff --git a/main/bridges/source/cpp_uno/msvc_win64_x86-64/abi.cxx b/main/bridges/source/cpp_uno/msvc_win64_x86-64/abi.cxx
index a1722d4011..a203737a70 100644
--- a/main/bridges/source/cpp_uno/msvc_win64_x86-64/abi.cxx
+++ b/main/bridges/source/cpp_uno/msvc_win64_x86-64/abi.cxx
@@ -66,16 +66,20 @@ bool x86_64::return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef
                 typelib_TypeDescription * pTypeDescr = 0;
                 TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef );
 
-                /* If the struct is larger than 8 bytes, pass it on the stack.  */
+                /* A struct is returned in a register only when its size is
+                 * 1/2/4/8 bytes; otherwise (here: > 8) it is returned via a
+                 * hidden pointer (in memory).  This logic was inverted, which
+                 * corrupted struct/exception return marshalling on x64 — e.g.
+                 * getAllExtensions returning nested Sequences (ref 0c2e3065a0). */
                 if ( pTypeDescr->nSize > 8 )
                 {
                     TYPELIB_DANGER_RELEASE( pTypeDescr );
-                    return false;
+                    return true;
                 }
                 else
                 {
                     TYPELIB_DANGER_RELEASE( pTypeDescr );
-                    return true;
+                    return false;
                 }
             }
 
diff --git a/main/bridges/source/cpp_uno/msvc_win64_x86-64/call.asm b/main/bridges/source/cpp_uno/msvc_win64_x86-64/call.asm
index beb2797521..402d7e2319 100644
--- a/main/bridges/source/cpp_uno/msvc_win64_x86-64/call.asm
+++ b/main/bridges/source/cpp_uno/msvc_win64_x86-64/call.asm
@@ -6,16 +6,16 @@
 ; to you under the Apache License, Version 2.0 (the
 ; "License"); you may not use this file except in compliance
 ; with the License.  You may obtain a copy of the License at
-;
+; 
 ;   http://www.apache.org/licenses/LICENSE-2.0
-;
+; 
 ; Unless required by applicable law or agreed to in writing,
 ; software distributed under the License is distributed on an
 ; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 ; KIND, either express or implied.  See the License for the
 ; specific language governing permissions and limitations
 ; under the License.
-;
+; 
 
 
 typelib_TypeClass_VOID equ 0
@@ -51,8 +51,8 @@ EXTERN cpp_vtable_call: PROC
 ; rbp+16 rsp+08 +----------------------------+ -------
 ;               | return address             |
 ; rbp+08 rsp--> +----------------------------+
-;               | old rbp                    |
-; rbp---------> +----------------------------+
+;               | caller's rbp               |
+; rbp---------> +----------------------------+ <------ 16 byte boundary
 ;               | pRegisterReturn memory     |
 ; rbp-08 -----> +----------------------------+
 ;               |                            |
@@ -72,14 +72,14 @@ EXTERN cpp_vtable_call: PROC
 ;
 
 privateSnippetExecutor PROC FRAME
-
 	push	rbp
+	.PUSHREG rbp
 	mov	rbp, rsp
+	.SETFRAME rbp, 0
 	sub	rsp, 48
-	.ALLOCSTACK(48)
 	.ENDPROLOG
 
-	; 4th param: sal_uInt64 *pRegisterReturn
+	; 4th param: sal_uInt64 *pRegisterReturn 
 	lea r9, -8[rbp]
 
 	; 3rd param: sal_Int32 nVtableOffset
@@ -98,7 +98,8 @@ privateSnippetExecutor PROC FRAME
 	mov rax, -8[rbp]
 	movsd xmm0, qword ptr -8[rbp]
 
-	leave
+	add rsp, 48
+        pop rbp
 	ret
 
 privateSnippetExecutor ENDP
@@ -121,7 +122,7 @@ privateSnippetExecutor ENDP
 ; rbp+16 -----> +---------------------------------------------+ -------
 ;               | return address                              |
 ; rbp+08 -----> +---------------------------------------------+
-;               | old rbp                                     |
+;               | caller's rbp                                |
 ; rbp --------> +---------------------------------------------+ <---- 16 byte boundary
 ;               | (possible 16 byte alignment placeholder)    |
 ; rbp-08 -----> +---------------------------------------------+
@@ -133,8 +134,9 @@ privateSnippetExecutor ENDP
 callVirtualMethod PROC FRAME
 
 	push rbp
+	.PUSHREG rbp
 	mov rbp, rsp
-	.ENDPROLOG
+	.SETFRAME rbp, 0
 
 	; Save our register arguments to the shadow space:
 	mov 16[rbp], rcx
@@ -142,28 +144,33 @@ callVirtualMethod PROC FRAME
 	mov 32[rbp], r8
 	mov 40[rbp], r9
 
-	; We must maintain the stack aligned to a 16 byte boundary:
+	; nStack rounded to multiple of 2, so the stack is aligned to a 16 byte boundary:
 	mov eax, 56[rbp]
-	cmp rax, 0
-	je stackIsEmpty
-	mov r11, rax
-	test rax,1
-	jz stackSizeEven
-	sub rsp, 8
-stackSizeEven:
-	mov r10, 48[rbp]
-	shl rax, 3        ; nStack is in units of sal_uInt64, and sizeof(sal_uInt64) == 8
-	add rax, r10
+	inc eax
+	shr eax, 1
+	shl eax, 1
+
+	; if nStack < 4, add (4 - nStack) empty slots to the stack:
+	mov r10d, 4
+	sub r10d, eax
+	js copyStack
+	shl r10, 3
+	sub rsp, r10
 
 copyStack:
+	mov r10, rax
+	shl rax, 3
+	add rax, 48[rbp]
+copyStackLoop:
 	sub rax, 8
 	push [rax]
-	dec r11
-	jne copyStack
+	dec r10
+	jne copyStackLoop
 
+populateArgumentRegisters:
 	; First 4 args are passed in registers. Floating point args needs to be
-	; in floating point registers, but those are free for us to clobber
-	; anyway, and the callee knows where to look, so put each arg in both
+	; in floating point registers, but those are volatile anyway,
+	; and the callee knows where to look, so put each arg in both
 	; its general purpose and its floating point register:
 	mov rcx, [rsp]
 	movsd xmm0, qword ptr [rsp]
@@ -173,11 +180,10 @@ copyStack:
 	movsd xmm2, qword ptr 16[rsp]
 	mov r9, 24[rsp]
 	movsd xmm3, qword ptr 24[rsp]
-	jmp callMethod
 
-stackIsEmpty:
-	sub rsp, 32       ; we still need shadow space
+	.ENDPROLOG
 
+	
 callMethod:
 	; Find the method pointer
 	mov rax, 16[rbp]
@@ -188,6 +194,7 @@ callMethod:
 	call qword ptr [r10]
 
 	mov r10d, 40[rbp]
+	mov r11, 32[rbp]
 	cmp r10, typelib_TypeClass_VOID
 	je cleanup
 	cmp r10, typelib_TypeClass_LONG
@@ -217,30 +224,31 @@ callMethod:
 
 	; https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2017
 	; "The same pointer must be returned by the callee in RAX."
-	jmp Lint64
+	jmp cleanup
 
 Lint64:
-	mov 32[rbp], rax
+	mov qword ptr [r11], rax
 	jmp cleanup
 
 Lint32:
-	mov 32[rbp], eax
+	mov dword ptr [r11], eax
 	jmp cleanup
 
 Lint16:
-	mov 32[rbp], ax
+	mov word ptr [r11], ax
 	jmp cleanup
 
 Lint8:
-	mov 32[rbp], al
+	mov byte ptr [r11], al
 	jmp cleanup
 
 Lfloat:
-	movsd qword ptr 32[rbp], xmm0
+	movsd qword ptr [r11], xmm0
 	jmp cleanup
 
 cleanup:
-	leave
+	lea rsp, 0[rbp]
+	pop rbp
 	ret
 
 callVirtualMethod ENDP
diff --git a/main/bridges/source/cpp_uno/msvc_win64_x86-64/cpp2uno.cxx b/main/bridges/source/cpp_uno/msvc_win64_x86-64/cpp2uno.cxx
index 5deb06b112..59f250784c 100644
--- a/main/bridges/source/cpp_uno/msvc_win64_x86-64/cpp2uno.cxx
+++ b/main/bridges/source/cpp_uno/msvc_win64_x86-64/cpp2uno.cxx
@@ -1,5 +1,5 @@
 /**************************************************************
- *
+ * 
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -7,16 +7,16 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ * 
  *   http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
+ * 
  *************************************************************/
 
 
@@ -343,7 +343,7 @@ extern "C" typelib_TypeClass cpp_vtable_call(
 //==================================================================================================
 extern "C" void privateSnippetExecutor( ... );
 
-int const codeSnippetSize = 44;
+int const codeSnippetSize = 48;
 
 unsigned char * codeSnippet(
     unsigned char * code, sal_Int32 functionIndex, sal_Int32 vtableOffset, bool isArgFloat[4])
@@ -366,8 +366,13 @@ unsigned char * codeSnippet(
     //  rsp+08 +----------------------------+ -------
     //         | return address             |
     //  rsp--> +----------------------------+
+    // 
     //
-    //
+
+    // When it doubt about correctness,
+    // uncomment this and disassemble at runtime:
+    // INT 0x3
+    //*p++ = 0xcc;
 
     if (isArgFloat[0])
     {
@@ -377,7 +382,7 @@ unsigned char * codeSnippet(
     else
     {
         // mov QWORD[rsp+8], rcx
-        *p++ = 0x48; *p++ = 0x49; *p++ = 0x4c; *p++ = 0x24; *p++ = 0x08;
+        *p++ = 0x48; *p++ = 0x89; *p++ = 0x4c; *p++ = 0x24; *p++ = 0x08;
     }
 
     if (isArgFloat[1])
@@ -388,7 +393,7 @@ unsigned char * codeSnippet(
     else
     {
         // mov QWORD[rsp+16], rdx
-        *p++ = 0x48; *p++ = 0x49; *p++ = 0x54; *p++ = 0x24; *p++ = 0x10;
+        *p++ = 0x48; *p++ = 0x89; *p++ = 0x54; *p++ = 0x24; *p++ = 0x10;
     }
 
     if (isArgFloat[2])
@@ -441,7 +446,7 @@ unsigned char * codeSnippet(
     *p++ = (((sal_uIntPtr)(&privateSnippetExecutor)) >> 56) & 0xff;
 
     // jmp r11
-    *p++ = 0x49;
+    *p++ = 0x41;
     *p++ = 0xff;
     *p++ = 0xe3;
 
diff --git a/main/bridges/source/cpp_uno/msvc_win64_x86-64/except.cxx b/main/bridges/source/cpp_uno/msvc_win64_x86-64/except.cxx
index 55f2aa4779..98218480ab 100644
--- a/main/bridges/source/cpp_uno/msvc_win64_x86-64/except.cxx
+++ b/main/bridges/source/cpp_uno/msvc_win64_x86-64/except.cxx
@@ -1,5 +1,5 @@
 /**************************************************************
- *
+ * 
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -7,16 +7,16 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ * 
  *   http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
+ * 
  *************************************************************/
 
 
@@ -47,6 +47,67 @@ using namespace ::std;
 using namespace ::osl;
 using namespace ::rtl;
 
+//##############################################################################
+// Windows's C++ exception  handling is built on top of SEH (Structured Exception Handling).
+//
+// SEH documentation:
+// https://web.archive.org/web/20060114142024/https://www.microsoft.com/msj/0197/exception/exception.aspx
+//
+// See this excellent article,
+// "Decoding the parameters of a thrown C++ exception (0xE06D7363)"
+// by Raymond Chen:
+// https://devblogs.microsoft.com/oldnewthing/20100730-00/?p=13273
+//
+// Then this one with more details on ExceptionInformation:
+// http://workblog.pilin.name/2014/03/decoding-parameters-of-thrown-c.html
+//
+// Others:
+// https://github.com/icestudent/ontl/blob/master/ntl/nt/exception.hxx
+// https://www.openrce.org/articles/full_view/21
+// https://www.openrce.org/articles/full_view/23
+//
+// For a C++ exception in SEH, on AMD64:
+//
+// +-----------------------------------+            +-------------------------------------------------------------+
+// |EXCEPTION_POINTERS                 |            |EXCEPTION_RECORD                                             |
+// +-----------------------------------+            +-------------------------------------------------------------+
+// |PEXCEPTION_RECORD  ExceptionRecord;|----------->|DWORD ExceptionCode; // == 0xE06D7363 for C++ exception      |
+// |PCONTEXT           ContextRecord;  |            |DWORD ExceptionFlags;                                        |
+// +-----------------------------------+            |struct  _EXCEPTION_RECORD *ExceptionRecord;                  |
+//                                                  |PVOID ExceptionAddress;                                      |
+//                                                  |DWORD NumberParameters; // == 4 on AMD64, 3 on i386          |
+//                                                  |ULONG_PTR ExceptionInformation[0];                           |
+//               C++ object being thrown <----------|ULONG_PTR ExceptionInformation[1];                           |
+//   +----------------------------------------------|ULONG_PTR ExceptionInformation[2];                           |
+//   |    HINSTANCE of the EXE/DLL where <----------|ULONG_PTR ExceptionInformation[3];                           |
+//   |    where the exception was thrown            |ULONG_PTR ExceptionInformation[...];                         |
+//   |                                              |ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];|
+//   | offset from HINSTANCE                        +-------------------------------------------------------------+
+//   | to:
+//   |     +------------------------------+
+//   |     |ThrowInfo                     |
+//   |     +------------------------------+
+//   +---->|unsigned int attributes;      |                             +----------------------------------+
+//         |PMFN   pmfnUnwind;            |                             |CatchableTypeArray                |
+//         |__int32   pForwardCompat;     | offset from HINSTANCE to:   +----------------------------------+
+//         |__int32   pCatchableTypeArray;|---------------------------->|int nCatchableTypes;              |
+//         +------------------------------+                    +--------|__int32   arrayOfCatchableTypes[];|
+//                                                             |        +----------------------------------+
+//        +------------------------+                           |
+//        |CatchableType           |                           |
+//        +------------------------+ offsets from HINSTANCE to |
+//        |unsigned int properties;|<--------------------------+        +--------------------------------+
+//        |__int32   pType;        |---------+                          |TypeDescriptor                  |
+//        |PMD    thisDisplacement;|         | offset from HINSTANCE to +--------------------------------+
+//        |int    sizeOrOffset;    |         +------------------------->|const void * _EH_PTR64 pVFTable;|
+//        |PMFN   copyFunction;    |                                    |void * _EH_PTR64   spare;       |
+//        +------------------------+                                    |char name[];                    |
+//                                                                      +--------------------------------+
+//
+//
+//
+//
+
 namespace CPPU_CURRENT_NAMESPACE
 {
 
@@ -117,9 +178,8 @@ class __type_info
 public:
     virtual ~__type_info() throw ();
 
-	inline __type_info( void * m_vtable, const char * m_d_name ) throw ()
-		: _m_vtable( m_vtable )
-		, _m_name( NULL )
+	inline __type_info( void * m_data, const char * m_d_name ) throw ()
+		: _m_data( m_data )
         { ::strcpy( _m_d_name, m_d_name ); } // #100211# - checked
 
 	size_t length() const
@@ -128,8 +188,7 @@ public:
 	}
 
 private:
-    void * _m_vtable;
-    char * _m_name;     // cached copy of unmangled name, NULL initially
+    void * _m_data;
     char _m_d_name[1];  // mangled name
 };
 //__________________________________________________________________________________________________
@@ -340,7 +399,7 @@ RaiseInfo::RaiseInfo( typelib_TypeDescription * pTypeDescr ) throw ()
 	, _n2( 0 )
 {
 	// a must be
-	OSL_ENSURE( sizeof(sal_Int32) == sizeof(ExceptionType *), "### pointer size differs from sal_Int32!" );
+	OSL_ENSURE( sizeof(sal_Int64) == sizeof(ExceptionType *), "### pointer size differs from sal_Int64!" );
 
 	::typelib_typedescription_acquire( pTypeDescr );
 	this->pTypeDescr = pTypeDescr;
@@ -427,7 +486,7 @@ ExceptionInfos::~ExceptionInfos() throw ()
 #if OSL_DEBUG_LEVEL > 1
 	OSL_TRACE( "> freeing exception infos... <\n" );
 #endif
-
+    
 	MutexGuard aGuard( _aMutex );
 	for ( t_string2PtrMap::const_iterator iPos( _allRaiseInfos.begin() );
           iPos != _allRaiseInfos.end(); ++iPos )
@@ -522,8 +581,8 @@ void mscx_raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
 
 	// a must be
 	OSL_ENSURE(
-        sizeof(sal_Int32) == sizeof(void *),
-        "### pointer size differs from sal_Int32!" );
+        sizeof(sal_Int64) == sizeof(void *),
+        "### pointer size differs from sal_Int64!" );
 	RaiseInfo *raiseInfo = ExceptionInfos::getRaiseInfo( pTypeDescr );
 	ULONG_PTR arFilterArgs[4];
 	arFilterArgs[0] = MSVC_magic_number;
@@ -549,9 +608,9 @@ int mscx_filterCppException(
     // handle only C++ exceptions:
 	if (pRecord == 0 || pRecord->ExceptionCode != MSVC_ExceptionCode)
         return EXCEPTION_CONTINUE_SEARCH;
-
+    
 #if _MSC_VER < 1300 // MSVC -6
-    bool rethrow = (pRecord->NumberParameters < 3 ||
+    bool rethrow = (pRecord->NumberParameters < 4 ||
                     pRecord->ExceptionInformation[ 2 ] == 0);
 #else
     bool rethrow = __CxxDetectRethrow( &pRecord );
@@ -574,7 +633,7 @@ int mscx_filterCppException(
     // rethrow: handle only C++ exceptions:
 	if (pRecord == 0 || pRecord->ExceptionCode != MSVC_ExceptionCode)
         return EXCEPTION_CONTINUE_SEARCH;
-
+    
     if (pRecord->NumberParameters == 4 &&
 //  		pRecord->ExceptionInformation[ 0 ] == MSVC_magic_number &&
 		pRecord->ExceptionInformation[ 1 ] != 0 &&
@@ -596,7 +655,7 @@ int mscx_filterCppException(
                             baseAddress + pType->_pTypeInfo )->_m_d_name,
                         RTL_TEXTENCODING_ASCII_US ) );
 				OUString aUNOname( toUNOname( aRTTIname ) );
-
+                
 				typelib_TypeDescription * pExcTypeDescr = 0;
 				typelib_typedescription_getByName(
                     &pExcTypeDescr, aUNOname.pData );
@@ -640,7 +699,7 @@ int mscx_filterCppException(
 #endif
 					typelib_typedescription_release( pExcTypeDescr );
 				}
-
+                
 				return EXCEPTION_EXECUTE_HANDLER;
 			}
 		}
@@ -660,3 +719,4 @@ int mscx_filterCppException(
 }
 
 #pragma pack(pop)
+


(openoffice) 16/20: build/win64: NSS/NSPR + CoinMP x64 external overlays [P4]

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 8db47c6cb7a2099bf85bbdb70a14bbd4cf3a5814
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Fri Jul 24 12:06:04 2026 +0200

    build/win64: NSS/NSPR + CoinMP x64 external overlays [P4]
    
    - nss: append two hunks to nss_win.patch (from the reference
      nss_win64.patch, origin/windows-amd64 9bbb3c7f6b): prsocket.c C89
      declaration-after-statement (VC9 compiles .c as C89) and blinit.c
      _xgetbv -> return 0 (the intrinsic needs VS2010 SP1+; disables AVX
      detection).  Add NSS_USE_64 to the overlay on x64 so freebl size_t>4
      static asserts (drbg.c) hold.  The hunks carry `diff -ur` separators --
      bazel's patch parser needs them to delimit files (GNU patch infers).
    - coinmp: drop hardcoded _X86_=1 (a pre-P2 leftover; the P2 sweep only
      touched main/* BUILD files, not external overlays).  On x64 it collided
      with the toolchain's global _AMD64_=1 and winnt.h defined _CONTEXT
      twice (C2011).
    
    Recompute the affected patch/overlay sha256 in each module's source.json.
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit b82f018cdda33ed91a50a41db341ccf135d66fc6)
---
 .../modules/coinmp/1.7.6/overlay/BUILD.bazel       |  4 ++-
 ext_libraries/modules/coinmp/1.7.6/source.json     |  2 +-
 ext_libraries/modules/nss/3.39/overlay/BUILD.bazel | 15 +++++++++-
 .../modules/nss/3.39/patches/nss_win.patch         | 32 ++++++++++++++++++++++
 ext_libraries/modules/nss/3.39/source.json         |  4 +--
 5 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/ext_libraries/modules/coinmp/1.7.6/overlay/BUILD.bazel b/ext_libraries/modules/coinmp/1.7.6/overlay/BUILD.bazel
index 73c7eeddff..578f716149 100644
--- a/ext_libraries/modules/coinmp/1.7.6/overlay/BUILD.bazel
+++ b/ext_libraries/modules/coinmp/1.7.6/overlay/BUILD.bazel
@@ -18,7 +18,9 @@ cc_binary(
         "COINMP_EXPORTS",
         "_CRT_SECURE_NO_DEPRECATE",
         "_CRT_SECURE_NO_WARNINGS",
-        "_X86_=1",
+        # Arch CPU define (_X86_ / _AMD64_) comes from the toolchain arch_defines
+        # globally — do NOT hardcode _X86_=1 here: on x64 it collides with the
+        # toolchain's _AMD64_=1 and winnt.h defines the CONTEXT struct twice (C2011).
     ],
     copts = ["/FIwindef.h"],
     win_def_file = "CoinMP/src/CoinMP.def",
diff --git a/ext_libraries/modules/coinmp/1.7.6/source.json b/ext_libraries/modules/coinmp/1.7.6/source.json
index ca3c304388..5701e65e6b 100644
--- a/ext_libraries/modules/coinmp/1.7.6/source.json
+++ b/ext_libraries/modules/coinmp/1.7.6/source.json
@@ -4,7 +4,7 @@
     "strip_prefix": "CoinMP-releases-1.7.6",
     "overlay": {
         "MODULE.bazel": "sha256-leibdbQi7pf+2uZbPTsVDcr7riTg8fX4zfoqEtyl65I=",
-        "BUILD.bazel":  "sha256-8FprSzd0502j0rjXQzswLPmEr3AzVRySwFJRpSHa+rE="
+        "BUILD.bazel":  "sha256-LasDks4dj7ASug2LKmR9crd+e58A/7TAdbDdsSBhDIM="
     },
     "patches": {},
     "patch_strip": 0
diff --git a/ext_libraries/modules/nss/3.39/overlay/BUILD.bazel b/ext_libraries/modules/nss/3.39/overlay/BUILD.bazel
index d28e1bb5cd..6e81203cc4 100644
--- a/ext_libraries/modules/nss/3.39/overlay/BUILD.bazel
+++ b/ext_libraries/modules/nss/3.39/overlay/BUILD.bazel
@@ -2,6 +2,13 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 
 package(default_visibility = ["//visibility:public"])
 
+# Local x64 selector — kept self-contained so this overlay never references
+# main-repo labels (same pattern as the boost.legacy overlay).
+config_setting(
+    name = "x64",
+    constraint_values = ["@platforms//cpu:x86_64"],
+)
+
 # ── Common flags ─────────────────────────────────────────────────────────────
 
 WIN_DEFINES = [
@@ -14,7 +21,13 @@ WIN_DEFINES = [
     "NDEBUG",
     "_USRDLL",
     "IEEE_8087",   # x86/x64 little-endian IEEE 754; required by nspr/dtoa.c
-]
+] + select({
+    # 64-bit build mode (coreconf USE_64=1 → -DNSS_USE_64).  Gates size_t>4
+    # code paths (e.g. freebl/drbg.c PR_STATIC_ASSERT) and 64-bit pointer
+    # assumptions.  Mirrors reference makefile.mk (origin/windows-amd64).
+    ":x64": ["NSS_USE_64"],
+    "//conditions:default": [],
+})
 
 WIN_COPTS = [
     "/W3",
diff --git a/ext_libraries/modules/nss/3.39/patches/nss_win.patch b/ext_libraries/modules/nss/3.39/patches/nss_win.patch
index 10d5efcee7..90b8df377f 100644
--- a/ext_libraries/modules/nss/3.39/patches/nss_win.patch
+++ b/ext_libraries/modules/nss/3.39/patches/nss_win.patch
@@ -2949,3 +2949,35 @@ diff -ur misc/nss-3.39/nss/lib/util/utilmod.c misc/build/nss-3.39/nss/lib/util/u
      if (!toWide) {
          PORT_Free(fromWide);
          return PR_FAILURE;
+diff -ur misc/nss-3.39/nspr/pr/src/io/prsocket.c misc/build/nss-3.39/nspr/pr/src/io/prsocket.c
+--- misc/nss-3.39/nspr/pr/src/io/prsocket.c	2025-01-21 18:09:11.629055000 +0200
++++ misc/build/nss-3.39/nspr/pr/src/io/prsocket.c	2025-01-21 18:11:44.990333000 +0200
+@@ -337,8 +337,8 @@
+      * input/output.
+      * To get result we need to use GetOverlappedResult. */
+     if (fd->secret->overlappedActive) {
+-        PR_ASSERT(fd->secret->nonblocking);
+         PRInt32 rvSent;
++        PR_ASSERT(fd->secret->nonblocking);
+         if (GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) {
+             fd->secret->overlappedActive = PR_FALSE;
+             PR_LOG(_pr_io_lm, PR_LOG_MIN,
+diff -ur misc/nss-3.39/nss/lib/freebl/blinit.c misc/build/nss-3.39/nss/lib/freebl/blinit.c
+--- misc/nss-3.39/nss/lib/freebl/blinit.c	2025-01-21 18:09:11.487953000 +0200
++++ misc/build/nss-3.39/nss/lib/freebl/blinit.c	2025-01-21 18:28:06.705161000 +0200
+@@ -50,14 +50,8 @@
+         mov xcr0, eax
+     }
+ #else
+-    xcr0 = (PRUint32)_xgetbv(0); /* Requires VS2010 SP1 or later. */
++    return 0;
+ #endif /* _M_IX86 */
+-#else  /* _MSC_VER */
+-    /* Old OSX compilers don't support xgetbv. Use byte form. */
+-    __asm__(".byte 0x0F, 0x01, 0xd0"
+-            : "=a"(xcr0)
+-            : "c"(0)
+-            : "%edx");
+ #endif /* _MSC_VER */
+     /* Check if xmm and ymm state are enabled in XCR0. */
+     return (xcr0 & 6) == 6;
diff --git a/ext_libraries/modules/nss/3.39/source.json b/ext_libraries/modules/nss/3.39/source.json
index 22e0422596..85b07a9e03 100644
--- a/ext_libraries/modules/nss/3.39/source.json
+++ b/ext_libraries/modules/nss/3.39/source.json
@@ -4,7 +4,7 @@
   "url": "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_39_RTM/src/nss-3.39-with-nspr-4.20.tar.gz",
   "overlay": {
     "MODULE.bazel":                    "sha256-mXRzSNFfz0l/ZE/gxIXrTXgGEu73DRFzcL03hpjgzWw=",
-    "BUILD.bazel":                     "sha256-BVN8Qf65vHdXoWqhWZQcmrQEbmftW8U+Ef9T5FoQiG0=",
+    "BUILD.bazel":                     "sha256-iacJ8e9bTRBAXvjJE+0NcYbV5+XompHcriE9vxCwaqo=",
     "nspr/pr/include/prcpucfg.h":      "sha256-epNyl8GFFwovhIu3m76CCZkyQlMxDlsitfA/83I/oS8=",
     "nspr/pr/src/_pr_bld.h":           "sha256-KbNBXdVYpv4NqdFTM9U1OGsXFI0t2Pvsv4p7b6dTnNE=",
     "nspr/lib/libc/src/_pl_bld.h":     "sha256-8EkKDhgBCnbvsC3iz8vHqVtm6Mzwq8VgAFjve6zRPcQ=",
@@ -14,7 +14,7 @@
   },
   "patches": {
     "nss.patch":       "sha256-PNisPTc+Syr3cnD+8Ixipw65zUrG2rOg1peBfXVcdck=",
-    "nss_win.patch":   "sha256-ORoSU5UGyh5eR5VfrS9LBDG5oHGPGmKyhC3ZYgvxvyA=",
+    "nss_win.patch":   "sha256-8F2wx79jkH2SAUYuEMznXApW7E0z2Yvc+fKJF9LcmmU=",
     "nss_sizes.patch": "sha256-OMYmfwozZnvzpRVl0ipMnbUsmedPULlPoGKBUsdONDw="
   },
   "patch_strip": 2


(openoffice) 10/20: build/win64: x64 C++/UNO bridge (mscx_uno) + sal/salhelper x64 fixes + round-trip test [P3]

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 866255a1208051ff89ff5544b2367955012929ad
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Tue Jul 21 12:14:41 2026 +0200

    build/win64: x64 C++/UNO bridge (mscx_uno) + sal/salhelper x64 fixes + round-trip test [P3]
    
    Builds the x64 C++/UNO ABI bridge and the fixes needed to link sal/salhelper
    for x64, plus a runtime test proving the bridge marshals a call.
    
    - bridges: new mscx_uno target (target_compatible_with x86_64) using the
      msvc_win64_x86-64 platform layer — call.asm via ml64, abi.cxx, cpp2uno/uno2cpp,
      except.cxx (x64 SEH) — with CPPU_ENV=mscx and mscx_uno.def (same 3 undecorated
      C exports as msci_uno.def, arch-neutral).  msci_uno is now x86-only (its inline
      __asm can't compile on x64).  The x64 bridge sets WINVER/_WIN32_WINNT=0x0600
      (its cpp2uno.cxx uses GetModuleHandleExW; 0x0500 is anachronistic on x64).
    - sal: on x64, uwinapi compiles only the 4 asm-free base TUs (the naked-__asm
      thunks need inline asm, which x64 MSVC lacks) and exports via a new Uwinapi64.def
      (single symbol) — mirrors the dmake makefile CPUNAME split; x86 unchanged.
    - salhelper: on x64, link with a new salhelperx64.def carrying x64 C++ name
      mangling (QEAA/PEAV/AEBV, size_t=_K), generated from the shipped mscx.map; x86
      keeps salhelper.def.
    - test: cppuno_roundtrip_test (gtest, both arches) maps a C++ XServiceInfo
      cpp->uno (loads the bridge DLL) and invokes a method via the uno_Interface
      dispatcher, exercising the bridge's marshalling and verifying the return.
    
    (sal/salhelper/bridges BUILD files also carry the [P2] arch-define strip.)
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit bd53cdd485facd1850d0107deddb7e7b0d79955d)
---
 main/bridges/BUILD.bazel                      | 150 +++++++++++++++++++++++---
 main/bridges/test/cppuno_roundtrip_test.cxx   | 144 +++++++++++++++++++++++++
 main/bridges/util/mscx_uno.def                |   8 ++
 main/sal/BUILD.bazel                          |  53 +++++----
 main/sal/systools/win32/uwinapi/Uwinapi64.def |   2 +
 main/salhelper/BUILD.bazel                    |   9 +-
 main/salhelper/util/salhelperx64.def          |  29 +++++
 7 files changed, 360 insertions(+), 35 deletions(-)

diff --git a/main/bridges/BUILD.bazel b/main/bridges/BUILD.bazel
index d1cb669c7d..e9ed08c788 100644
--- a/main/bridges/BUILD.bazel
+++ b/main/bridges/BUILD.bazel
@@ -2,7 +2,7 @@ package(default_visibility = ["//visibility:public"])
 
 load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 load("@rules_java//java:defs.bzl", "java_library")
-load("//build/rules:gtest_test.bzl", "staged_run_test")
+load("//build/rules:gtest_test.bzl", "gtest_test", "staged_run_test")
 
 _COPTS = [
     "/Zm500", "/Zc:forScope", "/GR", "/nologo", "/Gs",
@@ -19,7 +19,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     # Needed by vtablefactory.cxx for the Windows code path
     "LEAK_STATIC_DATA",
@@ -27,6 +27,44 @@ _DEFINES = [
 
 _SLO_DEFINES = _DEFINES + ["SHAREDLIB", "_DLL_"]
 
+# x64 (mscx) variants — same as the x86 flags but with the msvc_win64_x86-64
+# platform include and CPPU_ENV=mscx (the x64 C++/UNO environment name).
+_COPTS_X64 = [
+    "/Zm500", "/Zc:forScope", "/GR", "/nologo", "/Gs",
+    "/EHsc",
+    "/Dsnprintf=_snprintf",
+    "/Imain/bridges/source/cpp_uno/shared",
+    "/Imain/bridges/source/cpp_uno/msvc_win64_x86-64",
+    "/Imain/bridges/inc/pch",
+    "/wd4061", "/wd4127",
+]
+
+_DEFINES_X64 = [
+    "WNT", "GUI", "WIN32",
+    # Vista (0x0600) floor: x64 Windows is Vista+ (Win2000's 0x0500 is
+    # anachronistic on x64), and the trunk x64 cpp2uno.cxx calls GetModuleHandleExW
+    # (XP+/0x0501).  x86 keeps 0x0500 for legacy support; this is x64-only.
+    "WINVER=0x0600", "_WIN32_WINNT=0x0600", "_WIN32_IE=0x0600",
+    "CPPU_ENV=mscx",
+    "FULL_DESK",
+    "LEAK_STATIC_DATA",
+]
+
+_SLO_DEFINES_X64 = _DEFINES_X64 + ["SHAREDLIB", "_DLL_"]
+
+# Platform-neutral bridge sources shared by the x86 (msci) and x64 (mscx) DLLs.
+_BRIDGE_SHARED_SRCS = [
+    "source/cpp_uno/shared/bridge.cxx",
+    "source/cpp_uno/shared/component.cxx",
+    "source/cpp_uno/shared/component.hxx",
+    "source/cpp_uno/shared/cppinterfaceproxy.cxx",
+    "source/cpp_uno/shared/guardedarray.hxx",
+    "source/cpp_uno/shared/types.cxx",
+    "source/cpp_uno/shared/unointerfaceproxy.cxx",
+    "source/cpp_uno/shared/vtablefactory.cxx",
+    "source/cpp_uno/shared/vtables.cxx",
+]
+
 # ── Public headers ────────────────────────────────────────────────
 cc_library(
     name = "bridges_headers",
@@ -46,18 +84,8 @@ cc_library(
 # Sources: platform-neutral shared/ layer + msvc_win32_intel/ platform layer.
 cc_binary(
     name = "msci_uno",
-    srcs = [
-        # Shared (platform-neutral) sources
-        "source/cpp_uno/shared/bridge.cxx",
-        "source/cpp_uno/shared/component.cxx",
-        "source/cpp_uno/shared/component.hxx",
-        "source/cpp_uno/shared/cppinterfaceproxy.cxx",
-        "source/cpp_uno/shared/guardedarray.hxx",
-        "source/cpp_uno/shared/types.cxx",
-        "source/cpp_uno/shared/unointerfaceproxy.cxx",
-        "source/cpp_uno/shared/vtablefactory.cxx",
-        "source/cpp_uno/shared/vtables.cxx",
-        # Windows MSVC x86 platform sources
+    srcs = _BRIDGE_SHARED_SRCS + [
+        # Windows MSVC x86 platform sources (inline __asm; no call.asm/abi.cxx)
         "source/cpp_uno/msvc_win32_intel/cpp2uno.cxx",
         "source/cpp_uno/msvc_win32_intel/dllinit.cxx",
         "source/cpp_uno/msvc_win32_intel/except.cxx",
@@ -83,6 +111,8 @@ cc_binary(
         "$(execpath //main/sal:sal_implib)",
         "$(execpath //main/cppu:cppu3_implib)",
     ],
+    # x86 bridge: inline __asm doesn't compile on x64 — build only for x86.
+    target_compatible_with = ["@platforms//cpu:x86_32"],
     visibility = ["//visibility:public"],
 )
 
@@ -93,6 +123,55 @@ filegroup(
     visibility = ["//visibility:public"],
 )
 
+# ── mscx_uno.dll ─────────────────────────────────────────────────
+# Windows MSVC x64 C++/UNO bridge.  Loaded at runtime as "mscx_uno.dll"
+# (CPPU_ENV=mscx).  Uses the msvc_win64_x86-64/ platform layer: no inline __asm —
+# the vtable-slot trampoline is call.asm (ml64) with abi.cxx doing the x64 calling-
+# convention argument marshalling; except.cxx handles x64 SEH→UNO exception mapping.
+cc_binary(
+    name = "mscx_uno",
+    srcs = _BRIDGE_SHARED_SRCS + [
+        # Windows MSVC x64 platform sources
+        "source/cpp_uno/msvc_win64_x86-64/abi.cxx",
+        "source/cpp_uno/msvc_win64_x86-64/abi.hxx",
+        "source/cpp_uno/msvc_win64_x86-64/call.asm",
+        "source/cpp_uno/msvc_win64_x86-64/cpp2uno.cxx",
+        "source/cpp_uno/msvc_win64_x86-64/dllinit.cxx",
+        "source/cpp_uno/msvc_win64_x86-64/except.cxx",
+        "source/cpp_uno/msvc_win64_x86-64/mscx.hxx",
+        "source/cpp_uno/msvc_win64_x86-64/uno2cpp.cxx",
+    ],
+    copts = _COPTS_X64,
+    defines = _SLO_DEFINES_X64,
+    deps = [
+        ":bridges_headers",
+        "//main/sal:sal_headers",
+        "//main/cppu:cppu_headers",
+        "//main/udkapi:udkapi_idl_headers",
+        "//main/stlport:stlport",
+    ],
+    additional_linker_inputs = [
+        "//main/sal:sal_implib",
+        "//main/cppu:cppu3_implib",
+    ],
+    linkshared = True,
+    win_def_file = "util/mscx_uno.def",
+    linkopts = [
+        "$(execpath //main/sal:sal_implib)",
+        "$(execpath //main/cppu:cppu3_implib)",
+    ],
+    # x64-only bridge.
+    target_compatible_with = ["@platforms//cpu:x86_64"],
+    visibility = ["//visibility:public"],
+)
+
+filegroup(
+    name = "mscx_uno_implib",
+    srcs = [":mscx_uno"],
+    output_group = "interface_library",
+    visibility = ["//visibility:public"],
+)
+
 # ── java_uno bridge (Java↔C++ UNO bridge) ────────────────────────────────
 # Two cooperating artifacts:
 #   • java_uno.dll  — native JNI bridge (this cc_binary)
@@ -302,3 +381,46 @@ staged_run_test(
         "//main/cppu:cppu3",
     ],
 )
+
+# ── C++/UNO bridge round-trip test ───────────────────────────────
+# Maps a C++ object cpp->uno->cpp (which loads the bridge DLL) and calls methods
+# through the doubly-mapped proxy, exercising the bridge's asm trampoline +
+# argument/return marshalling in both directions at run time.  Arch-agnostic: the
+# bridge runtime dep select()s msci_uno (x86) / mscx_uno (x64), and the compiled
+# CPPU_ENV (msci/mscx) makes the mapping load the matching DLL — so this runs on
+# both arches.
+gtest_test(
+    name = "cppuno_roundtrip_test",
+    srcs = ["test/cppuno_roundtrip_test.cxx"],
+    copts = _TEST_COPTS,
+    defines = select({
+        "//build:arch_x64": _DEFINES_X64,
+        "//conditions:default": _DEFINES,
+    }),
+    deps = [
+        "//main/sal:sal_headers",
+        "//main/cppu:cppu_headers",
+        "//main/cppuhelper:cppuhelper_headers",
+        "//main/udkapi:udkapi_idl_headers",
+        "//main/stlport:stlport",
+    ],
+    additional_linker_inputs = [
+        "//main/sal:sal_implib",
+        "//main/cppu:cppu3_implib",
+        "//main/cppuhelper:cppuhelper_implib",
+    ],
+    linkopts = [
+        "$(execpath //main/sal:sal_implib)",
+        "$(execpath //main/cppu:cppu3_implib)",
+        "$(execpath //main/cppuhelper:cppuhelper_implib)",
+    ],
+    runtime_dlls = [
+        "//main/sal:sal3",
+        "//main/salhelper:salhelper3MSC",
+        "//main/cppu:cppu3",
+        "//main/cppuhelper:cppuhelper3MSC",
+    ] + select({
+        "//build:arch_x64": ["//main/bridges:mscx_uno"],
+        "//conditions:default": ["//main/bridges:msci_uno"],
+    }),
+)
diff --git a/main/bridges/test/cppuno_roundtrip_test.cxx b/main/bridges/test/cppuno_roundtrip_test.cxx
new file mode 100644
index 0000000000..4c1133d23f
--- /dev/null
+++ b/main/bridges/test/cppuno_roundtrip_test.cxx
@@ -0,0 +1,144 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// Focused C++/UNO bridge round-trip test.
+//
+// Maps a plain C++ UNO object from the C++ language-binding environment to the
+// binary UNO environment and back.  Constructing those Mappings loads the
+// C++/UNO bridge DLL — msci_uno.dll on x86, mscx_uno.dll on x64 (the name comes
+// from CPPU_CURRENT_LANGUAGE_BINDING_NAME).  A call on the doubly-mapped proxy
+// then traverses the full bridge path in both directions:
+//   C++ proxy vtable trampoline (call.asm) -> uno2cpp marshalling -> uno
+//   dispatch -> cpp2uno marshalling -> the original C++ object -> and the return
+//   value marshalled back.
+// So a green run proves the x64 bridge's asm + argument/return marshalling
+// actually work at run time, not merely that they link.
+
+#include "gtest/gtest.h"
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustring.h>
+#include <uno/environment.hxx>
+#include <uno/mapping.hxx>
+#include <uno/dispatcher.h>
+#include <uno/any2.h>
+#include <uno/lbnames.h>
+#include <typelib/typedescription.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using ::com::sun::star::lang::XServiceInfo;
+
+#define OUSTR(x) OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+namespace {
+
+// Minimal C++ UNO object.  XServiceInfo gives us a string return
+// (getImplementationName), a bool arg + bool return (supportsService) and a
+// sequence return (getSupportedServiceNames) — enough to exercise marshalling.
+class TestObj : public ::cppu::WeakImplHelper1< XServiceInfo >
+{
+public:
+    virtual OUString SAL_CALL getImplementationName()
+        throw (RuntimeException)
+        { return OUSTR("mscx.roundtrip.TestObj"); }
+
+    virtual sal_Bool SAL_CALL supportsService( const OUString & name )
+        throw (RuntimeException)
+        { return name.equalsAscii("Yes"); }
+
+    virtual Sequence< OUString > SAL_CALL getSupportedServiceNames()
+        throw (RuntimeException)
+        { Sequence< OUString > s(1); s[0] = OUSTR("svc.one"); return s; }
+};
+
+} // namespace
+
+TEST(CppUnoBridge, roundtrip)
+{
+    // These load the C++/UNO bridge DLL (<cpp-env>_uno.dll).
+    Mapping cpp2uno( Environment::getCurrent(), Environment( OUSTR(UNO_LB_UNO) ) );
+    Mapping uno2cpp( Environment( OUSTR(UNO_LB_UNO) ), Environment::getCurrent() );
+    ASSERT_TRUE( cpp2uno.is() );   // null => bridge DLL failed to load
+    ASSERT_TRUE( uno2cpp.is() );
+
+    Type const & rXSI = ::getCppuType( (Reference< XServiceInfo > *)0 );
+
+    Reference< XServiceInfo > xOrig( static_cast< XServiceInfo * >( new TestObj ) );
+
+    // Map C++ -> UNO(binary): the bridge (mscx_uno) wraps xOrig in a uno_Interface
+    // whose dispatcher marshals uno-form calls into C++ calls on xOrig.
+    void * pUno = 0;
+    cpp2uno.mapInterface( &pUno, xOrig.get(), rXSI );
+    ASSERT_TRUE( pUno != 0 );
+    uno_Interface * pUnoI = static_cast< uno_Interface * >( pUno );
+
+    // Map that uno_Interface back UNO -> C++.  UNO guarantees object identity across
+    // a round-trip back to the SAME environment, so the bridge collapses this to the
+    // original C++ object (xBack == xOrig).  This is correct behaviour, and proves the
+    // bridge's uno->cpp mapInterface recognises its own proxies.
+    void * pCppBack = 0;
+    uno2cpp.mapInterface( &pCppBack, pUno, rXSI );
+    ASSERT_TRUE( pCppBack != 0 );
+    Reference< XServiceInfo > xBack(
+        static_cast< XServiceInfo * >( pCppBack ), SAL_NO_ACQUIRE );
+    EXPECT_EQ( xOrig.get(), xBack.get() );   // identity preserved (collapse)
+
+    // Genuine marshalled call THROUGH the bridge: invoke getImplementationName on the
+    // uno_Interface proxy directly (no collapse).  This runs the bridge's marshalling
+    // in mscx_uno.dll: unmarshal the (empty) uno arg block, call xOrig's C++ vtable,
+    // and marshal the OUString return back into uno form (an rtl_uString*).
+    typelib_TypeDescription * pXsiTd = 0;
+    rXSI.getDescription( &pXsiTd );
+    if ( ! pXsiTd->bComplete )
+        typelib_typedescription_complete( &pXsiTd );
+    typelib_InterfaceTypeDescription * pItd =
+        reinterpret_cast< typelib_InterfaceTypeDescription * >( pXsiTd );
+    // ppAllMembers[0..2] = XInterface (queryInterface/acquire/release);
+    // [3] = XServiceInfo::getImplementationName (first local method).
+    ASSERT_TRUE( pItd->nAllMembers > 3 );
+    typelib_TypeDescription * pMethodTd = 0;
+    typelib_typedescriptionreference_getDescription( &pMethodTd, pItd->ppAllMembers[3] );
+    ASSERT_TRUE( pMethodTd != 0 );
+
+    rtl_uString * pRet = 0;         // uno-form return slot for a string method
+    uno_Any exc;
+    uno_Any * pExc = &exc;
+    (*pUnoI->pDispatcher)( pUnoI, pMethodTd, &pRet, 0, &pExc );
+
+    EXPECT_TRUE( pExc == 0 );        // no exception marshalled out
+    ASSERT_TRUE( pRet != 0 );
+    OUString ret( pRet );           // acquires
+    rtl_uString_release( pRet );    // drop the dispatcher's reference
+    EXPECT_TRUE( ret.equalsAscii("mscx.roundtrip.TestObj") );
+
+    typelib_typedescription_release( pMethodTd );
+    typelib_typedescription_release( pXsiTd );
+    (*pUnoI->release)( pUnoI );
+}
+
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
diff --git a/main/bridges/util/mscx_uno.def b/main/bridges/util/mscx_uno.def
new file mode 100644
index 0000000000..7ae183595a
--- /dev/null
+++ b/main/bridges/util/mscx_uno.def
@@ -0,0 +1,8 @@
+; Windows export file for mscx_uno.dll (x64 C++/UNO bridge)
+; Exports the three C-linkage entry points from source/cpp_uno/shared/component.cxx
+; (undecorated extern "C" names — identical on x86/x64; only the DLL name differs)
+LIBRARY mscx_uno
+EXPORTS
+    component_canUnload
+    uno_initEnvironment
+    uno_ext_getMapping
diff --git a/main/sal/BUILD.bazel b/main/sal/BUILD.bazel
index ae1699829d..bb7255e3a6 100644
--- a/main/sal/BUILD.bazel
+++ b/main/sal/BUILD.bazel
@@ -15,7 +15,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
@@ -107,32 +107,47 @@ cc_library(
 ## a Windows API compatibility shim
 cc_binary(
     name = "uwinapi",
-    srcs = glob(
-        [
-            "systools/win32/uwinapi/*.h",
-            "systools/win32/uwinapi/*.cpp",
-            "systools/win32/uwinapi/*.c",
-        ],
-        exclude = [
-            # function-body fragments — #include'd by other .cpp files
-            "systools/win32/uwinapi/GetLongPathName.cpp",
-            "systools/win32/uwinapi/GetUserDomain_NT.cpp",
-            "systools/win32/uwinapi/GetUserDomain_WINDOWS.cpp",
-            # not in original makefile SLOFILES — incomplete/broken TUs 
-            "systools/win32/uwinapi/SHILCreateFromPathW.cpp",
-            "systools/win32/uwinapi/MCIWndCreateW.cpp",
-            "systools/win32/uwinapi/sntprintf.c",
+    srcs = glob(["systools/win32/uwinapi/*.h"]) + select({
+        # x64: MSVC has no inline assembler, so the naked-__asm thunk forwarders
+        # (IMPLEMENT_THUNK / DEFINE_*_THUNK in macros.h) don't compile.  On x64
+        # Windows every shimmed API exists natively, so — mirroring the dmake
+        # makefile.mk CPUNAME split (INTEL adds the thunks; x64 builds only the
+        # asm-free base set) — compile just the four base TUs on x64.  Exports
+        # shrink to uwinapi64.dxp's single symbol (see the Uwinapi64.def below).
+        "//build:arch_x64": [
+            "systools/win32/uwinapi/ResolveThunk.cpp",
+            "systools/win32/uwinapi/SHCreateItemFromParsingName.cpp",
+            "systools/win32/uwinapi/snprintf.c",
+            "systools/win32/uwinapi/snwprintf.c",
         ],
-    ),
+        "//conditions:default": glob(
+            [
+                "systools/win32/uwinapi/*.cpp",
+                "systools/win32/uwinapi/*.c",
+            ],
+            exclude = [
+                # function-body fragments — #include'd by other .cpp files
+                "systools/win32/uwinapi/GetLongPathName.cpp",
+                "systools/win32/uwinapi/GetUserDomain_NT.cpp",
+                "systools/win32/uwinapi/GetUserDomain_WINDOWS.cpp",
+                # not in original makefile SLOFILES — incomplete/broken TUs
+                "systools/win32/uwinapi/SHILCreateFromPathW.cpp",
+                "systools/win32/uwinapi/MCIWndCreateW.cpp",
+                "systools/win32/uwinapi/sntprintf.c",
+            ],
+        ),
+    }),
     linkshared = True,
     copts = _COPTS,
     defines = _DEFINES,
     deps = [":sal_headers", ":uwinapi_fragments"],
     linkopts = [
-        "/DEF:main/sal/systools/win32/uwinapi/Uwinapi.def",
         "kernel32.lib", "user32.lib", "advapi32.lib",
         "version.lib", "shlwapi.lib",
-    ],
+    ] + select({
+        "//build:arch_x64": ["/DEF:main/sal/systools/win32/uwinapi/Uwinapi64.def"],
+        "//conditions:default": ["/DEF:main/sal/systools/win32/uwinapi/Uwinapi.def"],
+    }),
     visibility = ["//visibility:public"],
 )
 ## final shared dll
diff --git a/main/sal/systools/win32/uwinapi/Uwinapi64.def b/main/sal/systools/win32/uwinapi/Uwinapi64.def
new file mode 100644
index 0000000000..bd67aecb31
--- /dev/null
+++ b/main/sal/systools/win32/uwinapi/Uwinapi64.def
@@ -0,0 +1,2 @@
+EXPORTS
+	SHCreateItemFromParsingName
diff --git a/main/salhelper/BUILD.bazel b/main/salhelper/BUILD.bazel
index a13e093c35..b9770a4d30 100644
--- a/main/salhelper/BUILD.bazel
+++ b/main/salhelper/BUILD.bazel
@@ -12,7 +12,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
@@ -43,7 +43,12 @@ cc_binary(
     ],
     additional_linker_inputs = ["//main/sal:sal_implib"],
     linkshared = True,
-    win_def_file = "util/salhelper.def",
+    # x64 uses a .def with x64 C++ name mangling (mscx.map: __cdecl __ptr64
+    # QEAA/PEAV/AEBV, size_t=_K), vs x86's __thiscall QAE/AAV (msci.map).
+    win_def_file = select({
+        "//build:arch_x64": "util/salhelperx64.def",
+        "//conditions:default": "util/salhelper.def",
+    }),
     linkopts = [
         "$(execpath //main/sal:sal_implib)",
     ],
diff --git a/main/salhelper/util/salhelperx64.def b/main/salhelper/util/salhelperx64.def
new file mode 100644
index 0000000000..8100a06ecb
--- /dev/null
+++ b/main/salhelper/util/salhelperx64.def
@@ -0,0 +1,29 @@
+; Windows export file for salhelper3MSC.dll (x64 / mscx)
+; Derived from salhelper/source/mscx.map (all global: sections)
+; GetVersionInfo excluded (build-system artifact, not in source)
+LIBRARY salhelper3MSC
+EXPORTS
+    ??0ORealDynamicLoader@salhelper@@IEAA@PEAPEAV01@AEBVOUString@rtl@@1PEAX2@Z
+    ??1ORealDynamicLoader@salhelper@@MEAA@XZ
+    ??_7ORealDynamicLoader@salhelper@@6B@
+    ?acquire@ORealDynamicLoader@salhelper@@QEAAKXZ
+    ?getApi@ORealDynamicLoader@salhelper@@QEBAPEAXXZ
+    ?newInstance@ORealDynamicLoader@salhelper@@SAPEAV12@PEAPEAV12@AEBVOUString@rtl@@1@Z
+    ?release@ORealDynamicLoader@salhelper@@QEAAKXZ
+    ??1SimpleReferenceObject@salhelper@@MEAA@XZ
+    ??2SimpleReferenceObject@salhelper@@SAPEAX_K@Z
+    ??2SimpleReferenceObject@salhelper@@SAPEAX_KAEBUnothrow_t@std@@@Z
+    ??3SimpleReferenceObject@salhelper@@SAXPEAX@Z
+    ??3SimpleReferenceObject@salhelper@@SAXPEAXAEBUnothrow_t@std@@@Z
+    ??_7SimpleReferenceObject@salhelper@@6B@
+    ??0Condition@salhelper@@QEAA@AEAVMutex@osl@@@Z
+    ??1Condition@salhelper@@UEAA@XZ
+    ??0ConditionModifier@salhelper@@QEAA@AEAVCondition@1@@Z
+    ??1ConditionModifier@salhelper@@QEAA@XZ
+    ??0ConditionWaiter@salhelper@@QEAA@AEAVCondition@1@@Z
+    ??0ConditionWaiter@salhelper@@QEAA@AEAVCondition@1@K@Z
+    ??1ConditionWaiter@salhelper@@QEAA@XZ
+    ??0timedout@ConditionWaiter@salhelper@@QEAA@XZ
+    ??0timedout@ConditionWaiter@salhelper@@QEAA@AEBU012@@Z
+    ??1timedout@ConditionWaiter@salhelper@@UEAA@XZ
+    ??4timedout@ConditionWaiter@salhelper@@QEAAAEAU012@AEBU012@@Z


(openoffice) 13/20: build/win64: per-module x64 BUILD wiring (defs, manifests, /ENTRY, asm) [P5]

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 49198212414ae0f9ac2c775d80b0877db2d7059b
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Wed Jul 22 00:56:00 2026 +0200

    build/win64: per-module x64 BUILD wiring (defs, manifests, /ENTRY, asm) [P5]
    
    Arch-conditional build fixes surfaced while widening the x64 build through the
    GUI / app-framework tier.  All select() on //build:arch_x64; x86 unchanged.
    
    - jvmaccess: x86 uses an explicit x86-mangled .def, but there is no mscx.map;
      the source uses JVMACCESS_DLLPUBLIC (__declspec(dllexport)), so x64 links with
      an empty def (util/jvmaccessx64.def, LIBRARY only) and dllexport emits all 16
      exports with x64 mangling (like cppuhelper).
    - vcl: /ENTRY:LibMain@12 is x86 stdcall decoration; x64 has no @N -> select
      /ENTRY:LibMain.
    - basic: wnt.asm is the x86 stdcall trampoline for Basic Declare'd DLL calls;
      excluded on x64 (dllmgr.cxx uses the not-implemented stub there).
    - idl (svidl) / shell (lngconvex): these exec-tool bundles stage their own
      <tool>.exe.manifest hardcoding processorArchitecture="x86"; on the x64 host the
      loader then rejects the amd64 msvcr90.dll (0xC000007B).  Add util/amd64/
      <tool>.exe.manifest (amd64) and select the data entry (staged by basename).
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit 85b1ad448fa260940ad9d6460b8eb4c738e65398)
---
 main/basic/BUILD.bazel                       |  8 ++++++--
 main/idl/BUILD.bazel                         | 11 +++++++++--
 main/idl/util/amd64/svidl.exe.manifest       |  9 +++++++++
 main/jvmaccess/BUILD.bazel                   |  8 +++++++-
 main/jvmaccess/util/jvmaccessx64.def         |  8 ++++++++
 main/shell/BUILD.bazel                       |  8 ++++++--
 main/shell/util/amd64/lngconvex.exe.manifest |  9 +++++++++
 main/vcl/BUILD.bazel                         |  8 ++++++--
 8 files changed, 60 insertions(+), 9 deletions(-)

diff --git a/main/basic/BUILD.bazel b/main/basic/BUILD.bazel
index 17a4d0c84b..3f11f1978c 100644
--- a/main/basic/BUILD.bazel
+++ b/main/basic/BUILD.bazel
@@ -66,8 +66,12 @@ cc_binary(
         "source/inc/**",
     ]) + [
         "inc/pch/precompiled_basic.cxx",
-        "source/runtime/wnt.asm",
-    ],
+    ] + select({
+        # wnt.asm is the x86 stdcall trampoline for Basic Declare'd DLL calls; on
+        # x64 dllmgr.cxx uses the not-implemented stub instead (no asm to assemble).
+        "//build:arch_x64": [],
+        "//conditions:default": ["source/runtime/wnt.asm"],
+    }),
     copts = _COPTS,
     defines = _DEFINES + ["BASIC_DLLIMPLEMENTATION"],
     linkshared = True,
diff --git a/main/idl/BUILD.bazel b/main/idl/BUILD.bazel
index 8f1580a617..1c6c2dc8b5 100644
--- a/main/idl/BUILD.bazel
+++ b/main/idl/BUILD.bazel
@@ -72,8 +72,15 @@ cc_binary(
         "//main/basegfx:basegfx",
         "//main/i18npool:i18nisolang1MSC",
         "//main/external/msvcp90:crt_dlls",
-        "util/svidl.exe.manifest",
-    ],
+        # App manifest declares the CRT-assembly processorArchitecture; must match
+        # the (arch-selected) CRT.  x64 svidl is exec-built for the x64 host, so it
+        # needs the amd64 manifest — an x86 manifest makes the loader reject the
+        # amd64 msvcr90.dll (0xC000007B STATUS_INVALID_IMAGE_FORMAT).  Staged by
+        # basename, so both are named svidl.exe.manifest.
+    ] + select({
+        "//build:arch_x64": ["util/amd64/svidl.exe.manifest"],
+        "//conditions:default": ["util/svidl.exe.manifest"],
+    }),
     visibility = ["//visibility:public"],
 )
 
diff --git a/main/idl/util/amd64/svidl.exe.manifest b/main/idl/util/amd64/svidl.exe.manifest
new file mode 100644
index 0000000000..84685f3ebb
--- /dev/null
+++ b/main/idl/util/amd64/svidl.exe.manifest
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+  <assemblyIdentity version="1.0.0.0" processorArchitecture="amd64" name="svidl" type="win32"/>
+  <dependency>
+    <dependentAssembly>
+      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30729.1" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b"/>
+    </dependentAssembly>
+  </dependency>
+</assembly>
diff --git a/main/jvmaccess/BUILD.bazel b/main/jvmaccess/BUILD.bazel
index 5687b21920..cde6c14b02 100644
--- a/main/jvmaccess/BUILD.bazel
+++ b/main/jvmaccess/BUILD.bazel
@@ -41,7 +41,13 @@ cc_binary(
     copts = _COPTS,
     defines = _DEFINES,
     linkshared = True,
-    win_def_file = "util/jvmaccess.def",
+    # x86 uses explicit x86-mangled exports; x64 has no mscx.map, but the source
+    # uses JVMACCESS_DLLPUBLIC (__declspec(dllexport)) so an empty def suffices on
+    # x64 (dllexport emits all 16 exports with x64 mangling — like cppuhelper).
+    win_def_file = select({
+        "//build:arch_x64": "util/jvmaccessx64.def",
+        "//conditions:default": "util/jvmaccess.def",
+    }),
     deps = [
         ":jvmaccess_headers",
         "//main/sal:sal_headers",
diff --git a/main/jvmaccess/util/jvmaccessx64.def b/main/jvmaccess/util/jvmaccessx64.def
new file mode 100644
index 0000000000..156eda72a0
--- /dev/null
+++ b/main/jvmaccess/util/jvmaccessx64.def
@@ -0,0 +1,8 @@
+; jvmaccess3MSC.dll x64 export file.
+; Exports come from __declspec(dllexport) (JVMACCESS_DLLPUBLIC = SAL_DLLPUBLIC_EXPORT
+; in inc/jvmaccess/jvmaccessdllapi.h), which emits all 16 /EXPORT: directives with
+; correct x64 mangling — so this def only sets the LIBRARY name (same pattern as
+; cppuhelper3MSC.def).  The x86 jvmaccess.def lists explicit x86-mangled (__thiscall
+; QAE) names; x64 mangling differs (QEAA/PEAX/AEBV) and there is no mscx.map to
+; regenerate from, but dllexport already provides every export.
+LIBRARY jvmaccess3MSC
diff --git a/main/shell/BUILD.bazel b/main/shell/BUILD.bazel
index 40a0e7f998..0e999bec7c 100644
--- a/main/shell/BUILD.bazel
+++ b/main/shell/BUILD.bazel
@@ -408,8 +408,12 @@ cc_binary(
         "//main/basegfx:basegfx",
         "//main/i18npool:i18nisolang1MSC",
         "//main/external/msvcp90:crt_dlls",
-        "util/lngconvex.exe.manifest",
-    ],
+        # amd64 app manifest for the x64 (exec) tool — matches the arch-selected CRT
+        # (an x86 manifest → loader rejects amd64 msvcr90.dll, 0xC000007B).
+    ] + select({
+        "//build:arch_x64": ["util/amd64/lngconvex.exe.manifest"],
+        "//conditions:default": ["util/lngconvex.exe.manifest"],
+    }),
     visibility = ["//visibility:public"],
 )
 
diff --git a/main/shell/util/amd64/lngconvex.exe.manifest b/main/shell/util/amd64/lngconvex.exe.manifest
new file mode 100644
index 0000000000..fdc3c82696
--- /dev/null
+++ b/main/shell/util/amd64/lngconvex.exe.manifest
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+  <assemblyIdentity version="1.0.0.0" processorArchitecture="amd64" name="lngconvex" type="win32"/>
+  <dependency>
+    <dependentAssembly>
+      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30729.1" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b"/>
+    </dependentAssembly>
+  </dependency>
+</assembly>
diff --git a/main/vcl/BUILD.bazel b/main/vcl/BUILD.bazel
index 8cbae9417b..2887a03f9c 100644
--- a/main/vcl/BUILD.bazel
+++ b/main/vcl/BUILD.bazel
@@ -134,9 +134,13 @@ cc_binary(
         "advapi32.lib", "gdi32.lib", "gdiplus.lib", "imm32.lib",
         "mpr.lib", "msimg32.lib", "ole32.lib", "shell32.lib",
         "user32.lib", "uuid.lib", "version.lib", "winspool.lib",
-        "/ENTRY:LibMain@12",
+        # LibMain is WINAPI (__stdcall): x86 decorates it _LibMain@12; x64 has no
+        # stdcall @N decoration, so the entry symbol is the undecorated LibMain.
         "/MANIFEST:NO",
-    ],
+    ] + select({
+        "//build:arch_x64": ["/ENTRY:LibMain"],
+        "//conditions:default": ["/ENTRY:LibMain@12"],
+    }),
     visibility = ["//visibility:public"],
 )
 


(openoffice) 03/20: OOoRunner basic migration.

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 7e18bf4e52230381d91390aac4eebffe12abd260
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Sat Jun 27 02:30:35 2026 +0200

    OOoRunner basic migration.
---
 CLAUDE.md                 |  7 ++++++-
 main/qadevOOo/BUILD.bazel | 32 ++++++++++++++++++++++++++++++++
 main/qadevOOo/readme.md   | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 76 insertions(+), 1 deletion(-)

diff --git a/CLAUDE.md b/CLAUDE.md
index 918bf22176..d78ac0c94b 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -25,7 +25,12 @@ test          🔨  C++ unit-test infra runnable — NOW THE FRONT-LINE TASK: br
                    running-soffice fixture; cppunit suites need Phase-4 dep.
 testtools     ⬜  (bridgetest — pure-C++ UNO bridge round-trip; cli/pyuno/java variants
                    need rules_java — see Java bucket)
-qadevOOo      ⬜  (Java-based QA test framework; needs rules_java — see Java bucket)
+qadevOOo      🔨  OOoRunner.jar built (//main/qadevOOo:OOoRunner — qadevOOo QA
+                   framework, ~2137 classes; classpath ridl/unoil/jurt/juh_jar/
+                   java_uno_jar; .csv objdsc NOT jarred, manifest omitted).
+                   Unblocks bridges java_uno tests (acquire, java_remote).  STILL
+                   ⬜: OOoRunnerLight, qa/complex, JunitTest_qadevOOo_unoapi,
+                   testdocs — need running-soffice/OfficeConnection fixture.
 testgraphical ⬜  (graphical/visual regression tests; needs instsetoo_native + qadevOOo)
 
 ── Remaining: Java-based ────────────────────────────────────────────────
diff --git a/main/qadevOOo/BUILD.bazel b/main/qadevOOo/BUILD.bazel
new file mode 100644
index 0000000000..10a758af9e
--- /dev/null
+++ b/main/qadevOOo/BUILD.bazel
@@ -0,0 +1,32 @@
+load("@rules_java//java:defs.bzl", "java_library")
+
+# ── OOoRunner.jar ────────────────────────────────────────────────────────────
+# The qadevOOo test framework (lib.*, base.*, util.*, share.*, mod.* …) used as a
+# classpath library by UNO-Java API/integration tests — notably the bridges
+# java_uno tests (test/java_uno/acquire, com/sun/star/lib/.../java_remote/*).
+#
+# Classpath (build.xml main.classpath): ridl + unoil + jurt + juh + java_uno.
+#
+# Resources: src/main/resources holds ONLY the 670 objdsc/*.csv object-description
+# files, which the ant jar target does NOT bundle (.csv is absent from its include
+# list) — the runner reads them from the filesystem via an -objdsc parameter. So
+# this jar is compiled classes only, matching upstream.
+#
+# Manifest (Class-Path: ridl.jar unoil.jar / RegistrationClassName:
+# org.openoffice.RunnerService) is a deployment/UNO-registration detail not needed
+# for classpath use; omitted here, same as ridljar/unoloader (see ridljar/readme.md).
+java_library(
+    name = "OOoRunner",
+    srcs = glob(["java/OOoRunner/src/main/java/**/*.java"]),
+    # Legacy Java 1.4-era sources: pin --release 8 and silence Error Prone, same
+    # as jurt (modern JDK compiles them with deprecation/raw-type warnings only).
+    javacopts = ["--release", "8", "-XepDisableAllChecks"],
+    deps = [
+        "//main/ridljar:ridl",
+        "//main/unoil:unoil",
+        "//main/jurt:jurt",
+        "//main/javaunohelper:juh_jar",
+        "//main/bridges:java_uno_jar",
+    ],
+    visibility = ["//visibility:public"],
+)
diff --git a/main/qadevOOo/readme.md b/main/qadevOOo/readme.md
new file mode 100644
index 0000000000..5d7c955d2a
--- /dev/null
+++ b/main/qadevOOo/readme.md
@@ -0,0 +1,38 @@
+# qadevOOo — Bazel migration status: 🔨 (OOoRunner.jar done)
+
+## What builds
+
+| Target | Output | Description |
+|--------|--------|-------------|
+| `//main/qadevOOo:OOoRunner` | `libOOoRunner.jar` (3.5 MB, ~2137 classes) | The qadevOOo QA test framework (`lib.*`, `base.*`, `util.*`, `share.*`, `mod.*`, `ifc.*`, `helper.*`, `org.openoffice.*`). |
+
+`OOoRunner.jar` is the artifact the **bridges java_uno tests** need on their
+classpath (`test/java_uno/acquire`, `com/sun/star/lib/.../java_remote/*`) — it was
+the blocker noted in the bridges test matrix.
+
+## Key decisions
+
+- **Classpath = 5 migrated jars** (from `java/OOoRunner/build.xml` `main.classpath`):
+  `ridl`, `unoil`, `jurt`, `juh_jar`, `java_uno_jar`.
+  - ⚠️ The javaunohelper jar target is **`//main/javaunohelper:juh_jar`**, NOT
+    `:juh` (which is the `juh.dll` cc_binary). Depending on `:juh` gives no Java
+    classes → `package com.sun.star.comp.helper does not exist`
+    (Bootstrap/ComponentContext live there).
+- **`--release 8 -XepDisableAllChecks`** — 1538 legacy Java 1.4-era sources; modern
+  JDK compiles them with deprecation / unreachable-catch warnings only (same as
+  jurt). No source changes (out of scope).
+- **No resources in the jar.** `src/main/resources` holds ONLY 670
+  `objdsc/**/*.csv` object-description files, and the upstream ant jar target's
+  include list excludes `.csv` — the runner reads them from the filesystem via an
+  `-objdsc` run parameter, not the classpath. Jar = compiled classes only.
+- **Manifest omitted.** The hand-written manifest (`Class-Path: ridl.jar unoil.jar`
+  + `RegistrationClassName: org.openoffice.RunnerService`) is a deployment /
+  UNO-registration detail, irrelevant for classpath use — same treatment as
+  ridljar/unoloader.
+
+## Not yet migrated (rest of the module)
+
+- `java/OOoRunnerLight` (subset jar), `qa/complex/*` (junit complex tests),
+  `JunitTest_qadevOOo_unoapi` (the big UNO-API subsequent-test suite), `testdocs/*`
+  (C++/java test fixtures). These need the running-soffice / OfficeConnection
+  fixture and are part of the deferred subsequent-test bucket.


(openoffice) 02/20: java bridge migrated

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 1ca09b6d760989eee2987d8ea352faba824f901b
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Sat Jun 27 02:21:45 2026 +0200

    java bridge migrated
---
 CLAUDE.md                                    |   8 +-
 build/rules/gtest_test.bzl                   |   7 +
 main/bridges/BUILD.bazel                     | 212 +++++++++++++++++++++++++++
 main/bridges/readme.md                       |  74 ++++++++++
 main/bridges/test/inter_libs_exc/starter.def |   3 +
 main/bridges/test/inter_libs_exc/thrower.def |   3 +
 main/bridges/util/java_uno.def               |  16 ++
 main/staging/BUILD.bazel                     |   5 +
 8 files changed, 327 insertions(+), 1 deletion(-)

diff --git a/CLAUDE.md b/CLAUDE.md
index f56f7a43cb..918bf22176 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -28,7 +28,13 @@ testtools     ⬜  (bridgetest — pure-C++ UNO bridge round-trip; cli/pyuno/jav
 qadevOOo      ⬜  (Java-based QA test framework; needs rules_java — see Java bucket)
 testgraphical ⬜  (graphical/visual regression tests; needs instsetoo_native + qadevOOo)
 
-── Remaining: Java-based (gated on rules_java / UNO-Java component rules) ─
+── Remaining: Java-based ────────────────────────────────────────────────
+NOTE: rules_java 8.11.0 IS now wired (MODULE.bazel) and the core Java UNO
+runtime is migrated & green — ridljar/jurt/jvmaccess/javaunohelper/jvmfwk/
+bridges (incl. the java_uno JNI bridge: java_uno.dll + java_uno.jar, done
+2026-06-26)/stoc/io/remotebridges/unotools/unoil/pyuno.  The items below are
+the higher-level Java apps/extensions still to do (no longer gated on rules_java
+itself; per-module UNO-Java component/packaging rules may still be needed).
 reportbuilder ⬜  (pure Java .oxt extension; blockers: JFreeReport suite not on Maven, SourceForge ZIPs have token-based URLs; wizards dep also deferred)
 bean          ⬜  (Java bean component)
 saxon         ⬜  (XSLT 2.0 processor — IN SCOPE for full migration.  Feeds the
diff --git a/build/rules/gtest_test.bzl b/build/rules/gtest_test.bzl
index a2d913d2d2..15577a9ccf 100644
--- a/build/rules/gtest_test.bzl
+++ b/build/rules/gtest_test.bzl
@@ -84,6 +84,13 @@ _staged_gtest_test = rule(
     },
 )
 
+# The staging rule above is NOT gtest-specific: it stages an arbitrary /MD exe +
+# runtime DLLs + VC90 CRT + external manifest into one flat dir and runs it as a
+# test (pass/fail = process exit code).  Exposed for non-gtest runnable tests,
+# e.g. bridges' inter_libs_exc (a cross-DLL C++ exception smoke test whose exe
+# loads two sibling DLLs and exits 0 iff exception propagation works).
+staged_run_test = _staged_gtest_test
+
 def gtest_test(
         name,
         srcs,
diff --git a/main/bridges/BUILD.bazel b/main/bridges/BUILD.bazel
index f7c4ddaa58..d1cb669c7d 100644
--- a/main/bridges/BUILD.bazel
+++ b/main/bridges/BUILD.bazel
@@ -1,6 +1,8 @@
 package(default_visibility = ["//visibility:public"])
 
 load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
+load("@rules_java//java:defs.bzl", "java_library")
+load("//build/rules:gtest_test.bzl", "staged_run_test")
 
 _COPTS = [
     "/Zm500", "/Zc:forScope", "/GR", "/nologo", "/Gs",
@@ -90,3 +92,213 @@ filegroup(
     output_group = "interface_library",
     visibility = ["//visibility:public"],
 )
+
+# ── java_uno bridge (Java↔C++ UNO bridge) ────────────────────────────────
+# Two cooperating artifacts:
+#   • java_uno.dll  — native JNI bridge (this cc_binary)
+#   • java_uno.jar  — the Java side (java_library below), loaded reflectively
+# jurt's NativeThreadPool does System.loadLibrary("java_uno") at runtime, so the
+# .jar and .dll are linked only at runtime, not at build time.
+
+# Local copts for the jni_uno layer: quote-includes resolve same-dir, but the
+# explicit -I keeps cross-file jni_*.h includes robust.  inc/pch (for
+# precompiled_bridges_java_uno.hxx) and the UNO/sal/cppu/udkapi -I paths come in
+# via :bridges_headers and the header deps below.
+_JNI_COPTS = [
+    "/Zm500", "/Zc:forScope", "/GR", "/nologo", "/Gs",
+    "/EHsc",
+    # sal_Unicode must equal jchar (unsigned short). With native wchar_t it's a
+    # distinct type, so JNI calls like GetStringRegion(...,jchar*) reject
+    # sal_Unicode*. /Zc:wchar_t- makes wchar_t == unsigned short == sal_Unicode.
+    "/Zc:wchar_t-",
+    "/Dsnprintf=_snprintf",
+    "/Imain/bridges/source/jni_uno",
+    "/Imain/bridges/inc/pch",
+    "/wd4061", "/wd4127",
+]
+
+# ── java_uno.dll ─────────────────────────────────────────────────────────
+# JNICALL is __stdcall on Win32, so the Java_* methods would otherwise be
+# decorated _Java_...@N which the JVM cannot resolve; util/java_uno.def exports
+# the undecorated names (same pattern as jurt's jpipe.def).  The DEF also exports
+# the three UNO C entry points (uno_initEnvironment / uno_ext_getMapping /
+# component_canUnload) for the c++_uno↔java_uno mapping bridge.
+cc_binary(
+    name = "java_uno",
+    srcs = [
+        "source/jni_uno/jni_base.h",
+        "source/jni_uno/jni_bridge.cxx",
+        "source/jni_uno/jni_bridge.h",
+        "source/jni_uno/jni_data.cxx",
+        "source/jni_uno/jni_helper.h",
+        "source/jni_uno/jni_info.cxx",
+        "source/jni_uno/jni_info.h",
+        "source/jni_uno/jni_java2uno.cxx",
+        "source/jni_uno/jni_uno2java.cxx",
+        "source/jni_uno/nativethreadpool.cxx",
+    ],
+    copts = _JNI_COPTS,
+    # SOLAR_JAVA makes jvmaccess/virtualmachine.hxx #include the real <jni.h>
+    # instead of its stub typedefs (jint=int, jobject=void*); without it the stubs
+    # clash with the real jni.h pulled in by these sources → jint/JNIEnv redefinition.
+    defines = _SLO_DEFINES + ["SOLAR_JAVA"],
+    deps = [
+        ":bridges_headers",
+        "//main/sal:sal_headers",
+        "//main/cppu:cppu_headers",
+        "//main/udkapi:udkapi_idl_headers",
+        "//main/jvmaccess:jvmaccess_headers",
+        # jvmaccess/unovirtualmachine.hxx includes salhelper/simplereferenceobject.hxx
+        # but jvmaccess_headers doesn't propagate salhelper_headers (see its deps),
+        # so consumers must add it explicitly — same as jvmaccess3MSC does.
+        "//main/salhelper:salhelper_headers",
+        # jni_info.h uses ::std::hash_map, which only lives in std:: under stlport
+        # (VS2008 native puts hash_map in stdext::). Upstream relies on the global
+        # SOLAR stlport; here it's an explicit dep.
+        "//main/stlport:stlport",
+        "@rules_java//toolchains:jni",
+    ],
+    additional_linker_inputs = [
+        "//main/sal:sal_implib",
+        "//main/salhelper:salhelper_implib",
+        "//main/cppu:cppu3_implib",
+        "//main/jvmaccess:jvmaccess3MSC_implib",
+    ],
+    linkshared = True,
+    win_def_file = "util/java_uno.def",
+    linkopts = [
+        "$(execpath //main/sal:sal_implib)",
+        "$(execpath //main/salhelper:salhelper_implib)",
+        "$(execpath //main/cppu:cppu3_implib)",
+        "$(execpath //main/jvmaccess:jvmaccess3MSC_implib)",
+    ],
+    visibility = ["//visibility:public"],
+)
+
+# ── java_uno.jar ─────────────────────────────────────────────────────────
+# JNI_proxy + JNI_info_holder.  Helper classes (AsynchronousFinalizer,
+# NativeLibraryLoader) live in jurt; the UNO types come from ridl.  Sealed
+# manifest is a deployment detail (handled at staging), not a build concern.
+java_library(
+    name = "java_uno_jar",
+    srcs = glob(["java/java_uno/src/main/java/**/*.java"]),
+    javacopts = ["--release", "8", "-XepDisableAllChecks"],
+    deps = [
+        "//main/jurt:jurt",
+        "//main/ridljar:ridl",
+    ],
+    visibility = ["//visibility:public"],
+)
+
+# ═══════════════════════════════════════════════════════════════════════════
+# Tests
+# ═══════════════════════════════════════════════════════════════════════════
+# inter_libs_exc — verifies a UNO/C++ exception thrown in one shared library is
+# caught across the boundary in another (an MSVC RTTI/ABI sanity check for the
+# bridge's exception handling).  inter.exe loads thrower.dll + starter.dll by
+# bare name (osl::Module), thrower throws lang::IllegalArgumentException,
+# starter catches it.  Single process, no UNO connection, no Java — the only
+# bridges/test that runs without a qadevOOo/running-soffice fixture.
+
+_TEST_COPTS = [
+    "/EHsc", "/GR", "/nologo",
+    "/Dsnprintf=_snprintf",
+    "/Imain/bridges/inc/pch",  # precompiled_bridges.hxx (plain #include, not /Yu)
+]
+
+_TEST_DLL_DEFINES = _DEFINES + ["SHAREDLIB", "_DLL_"]
+
+# thrower.dll / starter.dll — target names MUST be the bare dll basenames because
+# inter.exe loads them via osl::Module("thrower"/"starter") (Windows LoadLibrary
+# resolves them from the staged exe's own directory).
+
+# thrower.dll — exports get_thrower(); throws a UNO exception.
+cc_binary(
+    name = "thrower",
+    srcs = [
+        "test/inter_libs_exc/thrower.cxx",
+        "test/inter_libs_exc/share.h",
+    ],
+    copts = _TEST_COPTS,
+    defines = _TEST_DLL_DEFINES,
+    testonly = True,
+    linkshared = True,
+    win_def_file = "test/inter_libs_exc/thrower.def",
+    deps = [
+        "//main/sal:sal_headers",
+        "//main/cppu:cppu_headers",
+        "//main/udkapi:udkapi_idl_headers",
+    ],
+    additional_linker_inputs = [
+        "//main/sal:sal_implib",
+        "//main/cppu:cppu3_implib",
+    ],
+    linkopts = [
+        "$(execpath //main/sal:sal_implib)",
+        "$(execpath //main/cppu:cppu3_implib)",
+        "/MANIFEST:NO",
+    ],
+)
+
+# starter.dll — exports start(p); calls p() and catches the exception.
+cc_binary(
+    name = "starter",
+    srcs = [
+        "test/inter_libs_exc/starter.cxx",
+        "test/inter_libs_exc/share.h",
+    ],
+    copts = _TEST_COPTS,
+    defines = _TEST_DLL_DEFINES,
+    testonly = True,
+    linkshared = True,
+    win_def_file = "test/inter_libs_exc/starter.def",
+    deps = [
+        "//main/sal:sal_headers",
+        "//main/cppu:cppu_headers",
+        "//main/udkapi:udkapi_idl_headers",
+    ],
+    additional_linker_inputs = [
+        "//main/sal:sal_implib",
+        "//main/cppu:cppu3_implib",
+    ],
+    linkopts = [
+        "$(execpath //main/sal:sal_implib)",
+        "$(execpath //main/cppu:cppu3_implib)",
+        "/MANIFEST:NO",
+    ],
+)
+
+# inter.exe — the driver; loads the two DLLs and invokes the throw/catch path.
+cc_binary(
+    name = "test_inter",
+    srcs = [
+        "test/inter_libs_exc/inter.cxx",
+        "test/inter_libs_exc/share.h",
+    ],
+    copts = _TEST_COPTS,
+    defines = _DEFINES,
+    testonly = True,
+    deps = [
+        "//main/sal:sal_headers",
+        "//main/cppu:cppu_headers",
+        "//main/udkapi:udkapi_idl_headers",
+    ],
+    additional_linker_inputs = ["//main/sal:sal_implib"],
+    linkopts = [
+        "$(execpath //main/sal:sal_implib)",
+        "/MANIFEST:NO",
+    ],
+)
+
+# Stage inter.exe + starter.dll + thrower.dll + sal3/cppu3 + CRT into one dir and
+# run it; passes iff it exits 0 (exception caught, no crash).
+staged_run_test(
+    name = "inter_libs_exc_test",
+    binary = ":test_inter",
+    runtime = [
+        ":starter",
+        ":thrower",
+        "//main/sal:sal3",
+        "//main/cppu:cppu3",
+    ],
+)
diff --git a/main/bridges/readme.md b/main/bridges/readme.md
index 949528d215..2510c902a4 100644
--- a/main/bridges/readme.md
+++ b/main/bridges/readme.md
@@ -1,5 +1,7 @@
 # Notes for bridges (done)
 
+## cpp_uno (C++↔UNO bridge) → `msci_uno.dll`
+
 - DLL name: `msci_uno` (from COMNAME=msci on WNT-INTEL-msci)
 - jurt/jvmaccess are Java bridge deps — skipped (not needed for C++ bridge)
 - Sources: `source/cpp_uno/shared/*.cxx` + `source/cpp_uno/msvc_win32_intel/*.cxx`
@@ -11,3 +13,75 @@
   — no RTTI symbols (bridge_exports.map symbols are GCC-mangled, don't apply to MSVC)
 - Links: cppu3.if.lib + sal.if.lib only (matches SHL1STDLIBS in makefile.mk)
 - VS2008 native STL provides `<hash_map>` without stlport (harmless warning only)
+
+## jni_uno (Java↔UNO bridge) → `java_uno.dll` + `java_uno.jar`
+
+The java_uno bridge is what makes Java UNO components talk to the C++ runtime.
+Two cooperating artifacts, linked only at runtime (jurt's `NativeThreadPool`
+calls `System.loadLibrary("java_uno")`), so there is no build-time cycle.
+
+- **`//main/bridges:java_uno` → `java_uno.dll`** — native JNI bridge.
+  Staged into `program/` via `//main/staging` (`collect_outputs`).
+  - 6 SLOFILES: `jni_info`, `jni_data`, `jni_uno2java`, `jni_java2uno`,
+    `jni_bridge`, `nativethreadpool` (from `makefile.mk` SLOFILES).
+  - Links (SHL1STDLIBS): jvmaccess + cppu3 + sal + salhelper implibs.
+  - `jni.h` via `@rules_java//toolchains:jni`; `precompiled_bridges_java_uno.hxx`
+    resolved by `/Imain/bridges/inc/pch`.
+  - **Three build landmines** (none hit by the sibling `msci_uno`, which doesn't
+    touch Java/JNI):
+    1. **`SOLAR_JAVA` define is mandatory.** `jvmaccess/virtualmachine.hxx` gates
+       `#include <jni.h>` behind `#ifdef SOLAR_JAVA`; in the `#else` it emits STUB
+       typedefs (`jint=int`, `jobject=void*`). Without the define those stubs clash
+       with the real jni.h these sources include → `jint/JNIEnv/JavaVM`
+       "redefinition; different basic types". (Also why `jvmaccess`/`javaunohelper`
+       set `SOLAR_JAVA`.)
+    2. **`/Zc:wchar_t-`** — `jni_info.h`/`jni_bridge.cxx` pass `sal_Unicode*` to JNI
+       `jchar*` params (e.g. `GetStringRegion`). `jchar` is `unsigned short`; native
+       `wchar_t` makes `sal_Unicode` a distinct type → C2664. The flag makes
+       `wchar_t == unsigned short == sal_Unicode == jchar`.
+    3. **stlport** — `jni_info.h` uses `::std::hash_map`, which only lives in `std::`
+       under stlport (VS2008 native is `stdext::hash_map`).
+  - **`salhelper_headers`** must be an explicit dep: `jvmaccess_headers` doesn't
+    propagate it even though `unovirtualmachine.hxx` includes
+    `salhelper/simplereferenceobject.hxx` (same workaround as `jvmaccess3MSC`).
+  - **Exports** (`util/java_uno.def`, converted from `java_uno.map`): the 3 UNO
+    C entry points (`uno_initEnvironment`, `uno_ext_getMapping`,
+    `component_canUnload`) **plus** the JNI natives. JNICALL is `__stdcall` on
+    Win32, so the linker would decorate `Java_*` as `_Java_...@N`, which the JVM
+    cannot resolve — the DEF lists the undecorated names (same trick as jurt's
+    `jpipe.def`). The `_1` in names like
+    `..._JNI_1proxy_dispatch_1call` is JNI's encoding of `_` in the
+    `com.sun.star.bridges.jni_uno` package / `JNI_proxy` class.
+- **`//main/bridges:java_uno_jar` → `java_uno.jar`** — the Java side:
+  `JNI_proxy` + `JNI_info_holder`. Deps: jurt (`AsynchronousFinalizer`,
+  `NativeLibraryLoader`) + ridl (`com.sun.star.uno.*`); `--release 8`.
+  Sealed manifest is a staging concern, not handled here.
+
+## Tests (`bridges/test/`)
+
+| Test | Kind | Bazel status |
+|------|------|--------------|
+| `inter_libs_exc` | single C++ process | ✅ `//main/bridges:inter_libs_exc_test` — runs & passes |
+| `java_uno/any`, `…/equals`, `…/nativethreadpool` | 2-process socket URP bridge (native `uno` ↔ java) | ⬜ deferred — multi-process orchestration fixture |
+| `java_uno/acquire` | same + `OOoRunner.jar` | ⬜ blocked on qadevOOo |
+| `com/sun/star/lib/uno/bridges/java_remote/*` | pure-Java JUnit-via-OOoRunner | ⬜ blocked on qadevOOo |
+| `performance` | UNO perf harness | ⬜ deferred (needs running UNO env) |
+| `testserver`/`testclient`/`testcomp`/`testsameprocess` | legacy CORBA-era (`com.sun.star.corba.giop`) | ⬜ likely obsolete |
+
+- **`inter_libs_exc_test`** — proves a `com.sun.star.lang.IllegalArgumentException`
+  thrown in `thrower.dll` is caught across the shared-library boundary in
+  `starter.dll` (an MSVC RTTI/ABI check).  `inter.exe` loads both via
+  `osl::Module("thrower"/"starter")`, so the cc_binary target names MUST be the
+  bare `thrower`/`starter` (the dll basenames it hard-codes).  Run via the generic
+  `staged_run_test` (the non-gtest form of `gtest_test`'s staging rule): inter.exe
+  + both dlls + sal3/cppu3 + VC90 CRT are staged into one dir; the test passes iff
+  the exe exits 0.  No UNO connection, no Java — the only test here that runs
+  without a qadevOOo / running-soffice fixture.
+- **Why the rest are deferred**: the `java_uno/*` tests were *manual* harnesses
+  upstream (each `readme.txt`: "run `…-server &`, sleep 3, run `…-client`") — the
+  makefile only builds the components + emits run-scripts.  The native `uno`
+  runner exists (`//main/cpputools:uno`), but automating them under `bazel test`
+  needs a 2-process socket fixture (port allocation, server-ready wait).
+  `acquire` + `java_remote` additionally need `OOoRunner.jar` from **qadevOOo**,
+  which is not migrated (frontier).  These belong with the deferred
+  OfficeConnection/subsequent-test bucket.
diff --git a/main/bridges/test/inter_libs_exc/starter.def b/main/bridges/test/inter_libs_exc/starter.def
new file mode 100644
index 0000000000..2382b2ebde
--- /dev/null
+++ b/main/bridges/test/inter_libs_exc/starter.def
@@ -0,0 +1,3 @@
+LIBRARY starter
+EXPORTS
+    start
diff --git a/main/bridges/test/inter_libs_exc/thrower.def b/main/bridges/test/inter_libs_exc/thrower.def
new file mode 100644
index 0000000000..f70d40eef7
--- /dev/null
+++ b/main/bridges/test/inter_libs_exc/thrower.def
@@ -0,0 +1,3 @@
+LIBRARY thrower
+EXPORTS
+    get_thrower
diff --git a/main/bridges/util/java_uno.def b/main/bridges/util/java_uno.def
new file mode 100644
index 0000000000..0996b9b0b6
--- /dev/null
+++ b/main/bridges/util/java_uno.def
@@ -0,0 +1,16 @@
+LIBRARY java_uno
+EXPORTS
+    uno_initEnvironment
+    uno_ext_getMapping
+    component_canUnload
+    Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_finalize__J
+    Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call
+    Java_com_sun_star_bridges_jni_1uno_JNI_1info_1holder_finalize__J
+    Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_attach
+    Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_create
+    Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_destroy
+    Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_detach
+    Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_dispose
+    Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_enter
+    Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_threadId
+    Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_putJob
diff --git a/main/staging/BUILD.bazel b/main/staging/BUILD.bazel
index e7f2c1d6c8..5cd65a96bd 100644
--- a/main/staging/BUILD.bazel
+++ b/main/staging/BUILD.bazel
@@ -72,6 +72,11 @@ collect_outputs(
         "//main/stoc:proxyfac.uno",
         "//main/binaryurp:binaryurp",
         "//main/bridges:msci_uno",
+        # Native JNI bridge (java_uno.dll). Loaded by jurt's NativeThreadPool via
+        # System.loadLibrary("java_uno") once Java is enabled. The Java side
+        # (java_uno.jar) needs the program/classes/ classpath staging, which does
+        # not exist yet — see readme.md "jni_uno" notes.
+        "//main/bridges:java_uno",
         "//main/io:streams",
         "//main/io:acceptor",
         "//main/io:connector",


(openoffice) 09/20: build/win64: strip hardcoded _X86_/INTEL from module BUILD files [P2]

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit c1d164c79b758c3c4cf7f95603dfb2d0551f2525
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Tue Jul 21 12:14:21 2026 +0200

    build/win64: strip hardcoded _X86_/INTEL from module BUILD files [P2]
    
    The arch CPU defines are now injected per-arch by the toolchain
    (default_compile_flags_list: x86 -> _X86_=1/INTEL, x64 -> _AMD64_=1/X86_64,
    see [P1]), so the literal "_X86_=1" / "INTEL" entries in the per-module
    defines lists are removed here.  WIN32 (arch-neutral on Windows) is kept.
    
    This lets the migrated core compile for x64 with no per-file arch flags, and
    is a no-op for the x86 build (the toolchain re-supplies the identical defines).
    Mechanical change across ~96 module BUILD.bazel files.
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit 32952be836c20cc7130dcfd08bf77e2a6fbe4304)
---
 main/UnoControls/BUILD.bazel                      |  2 +-
 main/accessibility/BUILD.bazel                    |  2 +-
 main/animations/BUILD.bazel                       |  2 +-
 main/avmedia/BUILD.bazel                          |  2 +-
 main/basctl/BUILD.bazel                           |  2 +-
 main/basebmp/BUILD.bazel                          |  2 +-
 main/basegfx/BUILD.bazel                          |  2 +-
 main/basic/BUILD.bazel                            |  2 +-
 main/binaryurp/BUILD.bazel                        |  2 +-
 main/canvas/BUILD.bazel                           |  2 +-
 main/chart2/BUILD.bazel                           |  2 +-
 main/codemaker/BUILD.bazel                        |  2 +-
 main/comphelper/BUILD.bazel                       |  2 +-
 main/configmgr/BUILD.bazel                        |  2 +-
 main/connectivity/BUILD.bazel                     |  2 +-
 main/cppcanvas/BUILD.bazel                        |  2 +-
 main/cppu/BUILD.bazel                             |  2 +-
 main/cppuhelper/BUILD.bazel                       |  2 +-
 main/cpputools/BUILD.bazel                        |  2 +-
 main/crashrep/BUILD.bazel                         |  2 +-
 main/cui/BUILD.bazel                              |  2 +-
 main/dbaccess/BUILD.bazel                         |  2 +-
 main/desktop/BUILD.bazel                          | 24 +++++++++++------------
 main/drawinglayer/BUILD.bazel                     |  2 +-
 main/dtrans/BUILD.bazel                           |  2 +-
 main/editeng/BUILD.bazel                          |  2 +-
 main/embeddedobj/BUILD.bazel                      |  2 +-
 main/embedserv/BUILD.bazel                        |  2 +-
 main/eventattacher/BUILD.bazel                    |  2 +-
 main/extensions/BUILD.bazel                       |  2 +-
 main/extensions/source/oooimprovement/BUILD.bazel |  2 +-
 main/fileaccess/BUILD.bazel                       |  2 +-
 main/filter/BUILD.bazel                           |  2 +-
 main/forms/BUILD.bazel                            |  2 +-
 main/formula/BUILD.bazel                          |  2 +-
 main/fpicker/BUILD.bazel                          |  2 +-
 main/framework/BUILD.bazel                        |  2 +-
 main/i18npool/BUILD.bazel                         |  2 +-
 main/i18npool/pool/BUILD.bazel                    |  2 +-
 main/i18nutil/BUILD.bazel                         |  2 +-
 main/idl/BUILD.bazel                              |  2 +-
 main/idlc/BUILD.bazel                             |  2 +-
 main/io/BUILD.bazel                               |  2 +-
 main/javaunohelper/BUILD.bazel                    |  2 +-
 main/jurt/BUILD.bazel                             |  2 +-
 main/jvmaccess/BUILD.bazel                        |  2 +-
 main/jvmfwk/BUILD.bazel                           |  2 +-
 main/l10ntools/BUILD.bazel                        |  2 +-
 main/lingucomponent/BUILD.bazel                   |  2 --
 main/linguistic/BUILD.bazel                       |  2 +-
 main/mysqlc/BUILD.bazel                           |  2 +-
 main/o3tl/BUILD.bazel                             |  2 +-
 main/oox/BUILD.bazel                              |  2 +-
 main/package/BUILD.bazel                          |  2 +-
 main/pyuno/BUILD.bazel                            |  2 +-
 main/rdbmaker/BUILD.bazel                         |  2 +-
 main/registry/BUILD.bazel                         |  2 +-
 main/remotebridges/BUILD.bazel                    |  2 +-
 main/reportdesign/BUILD.bazel                     |  2 +-
 main/rsc/BUILD.bazel                              |  2 +-
 main/sax/BUILD.bazel                              |  2 +-
 main/sc/BUILD.bazel                               |  2 +-
 main/scaddins/BUILD.bazel                         |  2 +-
 main/sccomp/BUILD.bazel                           |  2 +-
 main/scripting/BUILD.bazel                        |  2 +-
 main/sd/BUILD.bazel                               |  2 +-
 main/sdext/BUILD.bazel                            |  2 +-
 main/sfx2/BUILD.bazel                             |  2 +-
 main/shell/BUILD.bazel                            |  2 +-
 main/slideshow/BUILD.bazel                        |  2 +-
 main/sot/BUILD.bazel                              |  2 +-
 main/starmath/BUILD.bazel                         |  2 +-
 main/stoc/BUILD.bazel                             |  2 +-
 main/store/BUILD.bazel                            |  2 +-
 main/svgio/BUILD.bazel                            |  2 +-
 main/svl/BUILD.bazel                              |  2 +-
 main/svtools/BUILD.bazel                          |  2 +-
 main/svx/BUILD.bazel                              |  2 +-
 main/sw/BUILD.bazel                               |  2 +-
 main/test/BUILD.bazel                             |  2 +-
 main/toolkit/BUILD.bazel                          |  2 +-
 main/tools/BUILD.bazel                            |  4 ++--
 main/ucb/BUILD.bazel                              |  2 +-
 main/ucbhelper/BUILD.bazel                        |  2 +-
 main/unotools/BUILD.bazel                         |  2 +-
 main/unoxml/BUILD.bazel                           |  2 +-
 main/uui/BUILD.bazel                              |  2 +-
 main/vbahelper/BUILD.bazel                        |  2 +-
 main/vcl/BUILD.bazel                              |  2 +-
 main/vos/BUILD.bazel                              |  2 +-
 main/winaccessibility/BUILD.bazel                 |  2 +-
 main/writerfilter/BUILD.bazel                     |  2 +-
 main/xmlhelp/BUILD.bazel                          |  2 +-
 main/xmloff/BUILD.bazel                           |  2 +-
 main/xmlreader/BUILD.bazel                        |  2 +-
 main/xmlscript/BUILD.bazel                        |  2 +-
 main/xmlsecurity/BUILD.bazel                      |  2 +-
 97 files changed, 108 insertions(+), 110 deletions(-)

diff --git a/main/UnoControls/BUILD.bazel b/main/UnoControls/BUILD.bazel
index 8f3515d2c5..f3d4fc4a8b 100644
--- a/main/UnoControls/BUILD.bazel
+++ b/main/UnoControls/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/accessibility/BUILD.bazel b/main/accessibility/BUILD.bazel
index a32c8b2b28..eef4336722 100644
--- a/main/accessibility/BUILD.bazel
+++ b/main/accessibility/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "ACCESSIBILITY_DLLIMPLEMENTATION",
diff --git a/main/animations/BUILD.bazel b/main/animations/BUILD.bazel
index 453aa4498b..9c438eaa8d 100644
--- a/main/animations/BUILD.bazel
+++ b/main/animations/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/avmedia/BUILD.bazel b/main/avmedia/BUILD.bazel
index 3dae64fa61..ea72c76789 100644
--- a/main/avmedia/BUILD.bazel
+++ b/main/avmedia/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/basctl/BUILD.bazel b/main/basctl/BUILD.bazel
index 5620856fa3..63af557944 100644
--- a/main/basctl/BUILD.bazel
+++ b/main/basctl/BUILD.bazel
@@ -7,7 +7,7 @@ load("//build/rules:sdi_target.bzl", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "SUPD=680",
diff --git a/main/basebmp/BUILD.bazel b/main/basebmp/BUILD.bazel
index 7e7395f4ac..08ba7d042e 100644
--- a/main/basebmp/BUILD.bazel
+++ b/main/basebmp/BUILD.bazel
@@ -3,7 +3,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "BASEBMP_DLLIMPLEMENTATION",
diff --git a/main/basegfx/BUILD.bazel b/main/basegfx/BUILD.bazel
index 276fb6bc97..d047db8d6d 100644
--- a/main/basegfx/BUILD.bazel
+++ b/main/basegfx/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "BASEGFX_DLLIMPLEMENTATION",
diff --git a/main/basic/BUILD.bazel b/main/basic/BUILD.bazel
index edd46acadf..17a4d0c84b 100644
--- a/main/basic/BUILD.bazel
+++ b/main/basic/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/binaryurp/BUILD.bazel b/main/binaryurp/BUILD.bazel
index 7a6e14fe70..5022b59ac3 100644
--- a/main/binaryurp/BUILD.bazel
+++ b/main/binaryurp/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/canvas/BUILD.bazel b/main/canvas/BUILD.bazel
index 1323666ea3..5602bd1cb5 100644
--- a/main/canvas/BUILD.bazel
+++ b/main/canvas/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/chart2/BUILD.bazel b/main/chart2/BUILD.bazel
index 64a858edb7..59d574819e 100644
--- a/main/chart2/BUILD.bazel
+++ b/main/chart2/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rename_file", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/codemaker/BUILD.bazel b/main/codemaker/BUILD.bazel
index 528722f932..0690824abd 100644
--- a/main/codemaker/BUILD.bazel
+++ b/main/codemaker/BUILD.bazel
@@ -11,7 +11,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/comphelper/BUILD.bazel b/main/comphelper/BUILD.bazel
index 9c133bb3a4..4c6fc29291 100644
--- a/main/comphelper/BUILD.bazel
+++ b/main/comphelper/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:gtest_test.bzl", "gtest_test")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "COMPHELPER_DLLIMPLEMENTATION",
diff --git a/main/configmgr/BUILD.bazel b/main/configmgr/BUILD.bazel
index 87c99a48e2..977d76921b 100644
--- a/main/configmgr/BUILD.bazel
+++ b/main/configmgr/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/connectivity/BUILD.bazel b/main/connectivity/BUILD.bazel
index d20ed929f0..efe38df92c 100644
--- a/main/connectivity/BUILD.bazel
+++ b/main/connectivity/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/cppcanvas/BUILD.bazel b/main/cppcanvas/BUILD.bazel
index 92338e4a52..de4771d7ed 100644
--- a/main/cppcanvas/BUILD.bazel
+++ b/main/cppcanvas/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/cppu/BUILD.bazel b/main/cppu/BUILD.bazel
index 710ede207c..8d9cd217cb 100644
--- a/main/cppu/BUILD.bazel
+++ b/main/cppu/BUILD.bazel
@@ -14,7 +14,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/cppuhelper/BUILD.bazel b/main/cppuhelper/BUILD.bazel
index 925fc8a1a2..15b32d4614 100644
--- a/main/cppuhelper/BUILD.bazel
+++ b/main/cppuhelper/BUILD.bazel
@@ -15,7 +15,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/cpputools/BUILD.bazel b/main/cpputools/BUILD.bazel
index 25fb54cd10..36544449b6 100644
--- a/main/cpputools/BUILD.bazel
+++ b/main/cpputools/BUILD.bazel
@@ -3,7 +3,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/crashrep/BUILD.bazel b/main/crashrep/BUILD.bazel
index 6d298dafcd..27d57ba1e6 100644
--- a/main/crashrep/BUILD.bazel
+++ b/main/crashrep/BUILD.bazel
@@ -73,7 +73,7 @@ genrule(
 )
 
 _DEFINES = [
-    "WNT", "WIN32", "INTEL", "_X86_=1",
+    "WNT", "WIN32", 
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
     "snprintf=_snprintf",
     "SUPD=680",
diff --git a/main/cui/BUILD.bazel b/main/cui/BUILD.bazel
index 5f5274ab7d..79f4a663ee 100644
--- a/main/cui/BUILD.bazel
+++ b/main/cui/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "SUPD=680",
diff --git a/main/dbaccess/BUILD.bazel b/main/dbaccess/BUILD.bazel
index f12ac9bbac..e727afaf86 100644
--- a/main/dbaccess/BUILD.bazel
+++ b/main/dbaccess/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rename_file", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/desktop/BUILD.bazel b/main/desktop/BUILD.bazel
index 42c2622380..976c15248a 100644
--- a/main/desktop/BUILD.bazel
+++ b/main/desktop/BUILD.bazel
@@ -7,7 +7,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
@@ -762,7 +762,7 @@ cc_binary(
         "/Imain/desktop/inc/pch",
     ],
     defines = [
-        "WNT", "WIN32", "INTEL", "_X86_=1",
+        "WNT", "WIN32", 
         "snprintf=_snprintf",
         "SUPD=680", "MSC",
     ],
@@ -825,7 +825,7 @@ cc_binary(
         "/Imain/desktop/inc/pch",
     ],
     defines = [
-        "WNT", "WIN32", "INTEL", "_X86_=1",
+        "WNT", "WIN32", 
         "snprintf=_snprintf",
         "SUPD=680", "MSC", "UNICODE", "_UNICODE",
     ],
@@ -852,7 +852,7 @@ cc_binary(
         "/Imain/desktop/inc/pch",
     ],
     defines = [
-        "WNT", "WIN32", "INTEL", "_X86_=1",
+        "WNT", "WIN32", 
         "snprintf=_snprintf",
         "SUPD=680", "MSC", "UNICODE", "_UNICODE",
     ],
@@ -878,7 +878,7 @@ cc_binary(
         "/Imain/desktop/inc/pch",
     ],
     defines = [
-        "WNT", "WIN32", "INTEL", "_X86_=1",
+        "WNT", "WIN32", 
         "snprintf=_snprintf",
         "SUPD=680", "MSC", "UNICODE", "_UNICODE",
     ],
@@ -903,7 +903,7 @@ cc_binary(
         "/Imain/desktop/win32/source/guistdio",
     ],
     defines = [
-        "WNT", "WIN32", "INTEL", "_X86_=1",
+        "WNT", "WIN32", 
         "snprintf=_snprintf",
         "SUPD=680", "MSC",
     ],
@@ -926,7 +926,7 @@ cc_binary(
         "/Imain/desktop/win32/source/guistdio",
     ],
     defines = [
-        "WNT", "WIN32", "INTEL", "_X86_=1",
+        "WNT", "WIN32", 
         "snprintf=_snprintf",
         "SUPD=680", "MSC",
     ],
@@ -948,7 +948,7 @@ cc_binary(
         "/Imain/desktop/source/pkgchk/unopkg",
     ],
     defines = [
-        "WNT", "WIN32", "INTEL", "_X86_=1",
+        "WNT", "WIN32", 
         "snprintf=_snprintf",
         "SUPD=680", "MSC",
     ],
@@ -979,7 +979,7 @@ cc_binary(
         "/Imain/desktop/inc/pch",
     ],
     defines = [
-        "WNT", "WIN32", "INTEL", "_X86_=1",
+        "WNT", "WIN32", 
         "snprintf=_snprintf",
         "SUPD=680", "MSC", "UNICODE", "_UNICODE",
     ],
@@ -1003,7 +1003,7 @@ cc_binary(
         "/Imain/desktop/inc/pch",
     ],
     defines = [
-        "WNT", "WIN32", "INTEL", "_X86_=1",
+        "WNT", "WIN32", 
         "snprintf=_snprintf",
         "SUPD=680", "MSC", "UNICODE", "_UNICODE",
     ],
@@ -1030,7 +1030,7 @@ cc_binary(
         "/Imain/desktop/inc/pch",
     ],
     defines = [
-        "WNT", "WIN32", "INTEL", "_X86_=1",
+        "WNT", "WIN32", 
         "snprintf=_snprintf",
         "SUPD=680", "MSC", "UNICODE", "_UNICODE",
     ],
@@ -1056,7 +1056,7 @@ cc_binary(
         "/Imain/desktop/win32/source/QuickStart",
     ],
     defines = [
-        "WNT", "WIN32", "INTEL", "_X86_=1",
+        "WNT", "WIN32", 
         "snprintf=_snprintf",
         "SUPD=680", "MSC",
     ],
diff --git a/main/drawinglayer/BUILD.bazel b/main/drawinglayer/BUILD.bazel
index 049a8a864c..639630532b 100644
--- a/main/drawinglayer/BUILD.bazel
+++ b/main/drawinglayer/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/dtrans/BUILD.bazel b/main/dtrans/BUILD.bazel
index 6f1476700e..f49fc35c73 100644
--- a/main/dtrans/BUILD.bazel
+++ b/main/dtrans/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
 ]
 
diff --git a/main/editeng/BUILD.bazel b/main/editeng/BUILD.bazel
index 37327d32b4..8ee31a4651 100644
--- a/main/editeng/BUILD.bazel
+++ b/main/editeng/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/embeddedobj/BUILD.bazel b/main/embeddedobj/BUILD.bazel
index 78b7a7910b..a80056765c 100644
--- a/main/embeddedobj/BUILD.bazel
+++ b/main/embeddedobj/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/embedserv/BUILD.bazel b/main/embedserv/BUILD.bazel
index 88924b8528..99386e9cab 100644
--- a/main/embedserv/BUILD.bazel
+++ b/main/embedserv/BUILD.bazel
@@ -16,7 +16,7 @@ _ATL_REQUIRED = select({
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/eventattacher/BUILD.bazel b/main/eventattacher/BUILD.bazel
index 9f88107471..88d3b3c4cc 100644
--- a/main/eventattacher/BUILD.bazel
+++ b/main/eventattacher/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/extensions/BUILD.bazel b/main/extensions/BUILD.bazel
index 6916546738..2e31ad3c25 100644
--- a/main/extensions/BUILD.bazel
+++ b/main/extensions/BUILD.bazel
@@ -30,7 +30,7 @@ filegroup(
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/extensions/source/oooimprovement/BUILD.bazel b/main/extensions/source/oooimprovement/BUILD.bazel
index 6580a47e09..4552c375d8 100644
--- a/main/extensions/source/oooimprovement/BUILD.bazel
+++ b/main/extensions/source/oooimprovement/BUILD.bazel
@@ -20,7 +20,7 @@ cc_binary(
     defines = [
         "WNT", "GUI", "WIN32",
         "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-        "CPPU_ENV=msci", "INTEL", "_X86_=1",
+        "CPPU_ENV=msci", 
         "FULL_DESK", "SHAREDLIB", "_DLL_",
         "snprintf=_snprintf",
         "snwprintf=_snwprintf",
diff --git a/main/fileaccess/BUILD.bazel b/main/fileaccess/BUILD.bazel
index 3c33d46d4f..3e6f3a7c78 100644
--- a/main/fileaccess/BUILD.bazel
+++ b/main/fileaccess/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "FILEACCESS_DLLIMPLEMENTATION",
diff --git a/main/filter/BUILD.bazel b/main/filter/BUILD.bazel
index 9e2a92569a..7006f0f478 100644
--- a/main/filter/BUILD.bazel
+++ b/main/filter/BUILD.bazel
@@ -7,7 +7,7 @@ load("//main/filter:filter_rules.bzl", "FILTER_COPTS", "FILTER_HDR_DEPS", "graph
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/forms/BUILD.bazel b/main/forms/BUILD.bazel
index 75c39ca3f2..5b9981004d 100644
--- a/main/forms/BUILD.bazel
+++ b/main/forms/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/formula/BUILD.bazel b/main/formula/BUILD.bazel
index ca3ee76ca1..790efc230a 100644
--- a/main/formula/BUILD.bazel
+++ b/main/formula/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/fpicker/BUILD.bazel b/main/fpicker/BUILD.bazel
index b6cf6ceee8..bf5de2a007 100644
--- a/main/fpicker/BUILD.bazel
+++ b/main/fpicker/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
 ]
 
diff --git a/main/framework/BUILD.bazel b/main/framework/BUILD.bazel
index d44fe67f12..a77a229f9c 100644
--- a/main/framework/BUILD.bazel
+++ b/main/framework/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/i18npool/BUILD.bazel b/main/i18npool/BUILD.bazel
index b1557b7c63..de215f5543 100644
--- a/main/i18npool/BUILD.bazel
+++ b/main/i18npool/BUILD.bazel
@@ -7,7 +7,7 @@ load("//build/rules:localedata_pipeline.bzl", "localedata_gen")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "I18NPOOL_DLLIMPLEMENTATION",
diff --git a/main/i18npool/pool/BUILD.bazel b/main/i18npool/pool/BUILD.bazel
index ef95fba6d4..25de05c545 100644
--- a/main/i18npool/pool/BUILD.bazel
+++ b/main/i18npool/pool/BUILD.bazel
@@ -7,7 +7,7 @@ load("//main/i18npool:breakiter_pipeline.bzl", "breakiter_data")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "I18NPOOL_DLLIMPLEMENTATION",
diff --git a/main/i18nutil/BUILD.bazel b/main/i18nutil/BUILD.bazel
index 2858ac02e8..d2c867ca37 100644
--- a/main/i18nutil/BUILD.bazel
+++ b/main/i18nutil/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "I18NUTIL_DLLIMPLEMENTATION",
diff --git a/main/idl/BUILD.bazel b/main/idl/BUILD.bazel
index 4157f53776..8f1580a617 100644
--- a/main/idl/BUILD.bazel
+++ b/main/idl/BUILD.bazel
@@ -4,7 +4,7 @@ load("//build/rules:sdi_target.bzl", "svidl_bundle")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "snprintf=_snprintf",
     "IDL_COMPILER",
 ]
diff --git a/main/idlc/BUILD.bazel b/main/idlc/BUILD.bazel
index a5b3c2dc32..51e77991d6 100644
--- a/main/idlc/BUILD.bazel
+++ b/main/idlc/BUILD.bazel
@@ -16,7 +16,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/io/BUILD.bazel b/main/io/BUILD.bazel
index 1163cb67db..009fabfe32 100644
--- a/main/io/BUILD.bazel
+++ b/main/io/BUILD.bazel
@@ -15,7 +15,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/javaunohelper/BUILD.bazel b/main/javaunohelper/BUILD.bazel
index f3fb187d17..62b5034c6f 100644
--- a/main/javaunohelper/BUILD.bazel
+++ b/main/javaunohelper/BUILD.bazel
@@ -14,7 +14,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "SHAREDLIB", "_DLL_",
     "SOLAR_JAVA",
 ]
diff --git a/main/jurt/BUILD.bazel b/main/jurt/BUILD.bazel
index 2e75c1622b..ef1af69bc2 100644
--- a/main/jurt/BUILD.bazel
+++ b/main/jurt/BUILD.bazel
@@ -4,7 +4,7 @@ load("@rules_java//java:defs.bzl", "java_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "INTEL", "_X86_=1",
+    
     "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/jvmaccess/BUILD.bazel b/main/jvmaccess/BUILD.bazel
index 3111688c59..5687b21920 100644
--- a/main/jvmaccess/BUILD.bazel
+++ b/main/jvmaccess/BUILD.bazel
@@ -11,7 +11,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "SOLAR_JAVA",
diff --git a/main/jvmfwk/BUILD.bazel b/main/jvmfwk/BUILD.bazel
index 4011969973..394f6024f8 100644
--- a/main/jvmfwk/BUILD.bazel
+++ b/main/jvmfwk/BUILD.bazel
@@ -17,7 +17,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "JVMFWK_DLLIMPLEMENTATION",
diff --git a/main/l10ntools/BUILD.bazel b/main/l10ntools/BUILD.bazel
index 51e4acb2ee..698d33b174 100644
--- a/main/l10ntools/BUILD.bazel
+++ b/main/l10ntools/BUILD.bazel
@@ -9,7 +9,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "snprintf=_snprintf",
     "YY_NEVER_INTERACTIVE=1",   # suppress flex interactive-mode check
diff --git a/main/lingucomponent/BUILD.bazel b/main/lingucomponent/BUILD.bazel
index 917662cc84..d826ee57e7 100644
--- a/main/lingucomponent/BUILD.bazel
+++ b/main/lingucomponent/BUILD.bazel
@@ -8,8 +8,6 @@ _DEFINES = [
     "WIN32",
     "_WINDOWS",
     "CPPU_ENV=msci",
-    "INTEL",
-    "_X86_=1",
     "snprintf=_snprintf",
     "SUPD=680",
 ]
diff --git a/main/linguistic/BUILD.bazel b/main/linguistic/BUILD.bazel
index e510cacc10..9b21c55f35 100644
--- a/main/linguistic/BUILD.bazel
+++ b/main/linguistic/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/mysqlc/BUILD.bazel b/main/mysqlc/BUILD.bazel
index 62a29a7082..8d297380b6 100644
--- a/main/mysqlc/BUILD.bazel
+++ b/main/mysqlc/BUILD.bazel
@@ -10,7 +10,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "SUPD=680",
diff --git a/main/o3tl/BUILD.bazel b/main/o3tl/BUILD.bazel
index bff8db6d44..e51a3d1696 100644
--- a/main/o3tl/BUILD.bazel
+++ b/main/o3tl/BUILD.bazel
@@ -26,7 +26,7 @@ gtest_test(
         "/Zc:wchar_t-",
     ],
     defines = [
-        "WNT", "WIN32", "INTEL", "_X86_=1",
+        "WNT", "WIN32", 
         "snprintf=_snprintf",
     ],
     deps = [
diff --git a/main/oox/BUILD.bazel b/main/oox/BUILD.bazel
index ca739c5acd..5034bdcc02 100644
--- a/main/oox/BUILD.bazel
+++ b/main/oox/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/package/BUILD.bazel b/main/package/BUILD.bazel
index 27224e832c..6cae000e1b 100644
--- a/main/package/BUILD.bazel
+++ b/main/package/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "PACKAGE_DLLIMPLEMENTATION",
diff --git a/main/pyuno/BUILD.bazel b/main/pyuno/BUILD.bazel
index e6ea9ab693..76d8131009 100644
--- a/main/pyuno/BUILD.bazel
+++ b/main/pyuno/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/rdbmaker/BUILD.bazel b/main/rdbmaker/BUILD.bazel
index 960a6a9e93..d7e335013d 100644
--- a/main/rdbmaker/BUILD.bazel
+++ b/main/rdbmaker/BUILD.bazel
@@ -14,7 +14,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/registry/BUILD.bazel b/main/registry/BUILD.bazel
index bf74f86cff..d52ce725f4 100644
--- a/main/registry/BUILD.bazel
+++ b/main/registry/BUILD.bazel
@@ -12,7 +12,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/remotebridges/BUILD.bazel b/main/remotebridges/BUILD.bazel
index eb72c29c39..54ebea9607 100644
--- a/main/remotebridges/BUILD.bazel
+++ b/main/remotebridges/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/reportdesign/BUILD.bazel b/main/reportdesign/BUILD.bazel
index 30d11bbcd4..c734a8e09f 100644
--- a/main/reportdesign/BUILD.bazel
+++ b/main/reportdesign/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "REPORTDESIGN_DLLIMPLEMENTATION",
diff --git a/main/rsc/BUILD.bazel b/main/rsc/BUILD.bazel
index 8e5a346233..bdf20e9c69 100644
--- a/main/rsc/BUILD.bazel
+++ b/main/rsc/BUILD.bazel
@@ -13,7 +13,7 @@ cc_library(
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "snprintf=_snprintf",
 ]
diff --git a/main/sax/BUILD.bazel b/main/sax/BUILD.bazel
index ac7ae9a871..c4edef0901 100644
--- a/main/sax/BUILD.bazel
+++ b/main/sax/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:gtest_test.bzl", "gtest_test")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/sc/BUILD.bazel b/main/sc/BUILD.bazel
index 730f906681..b05addfe4a 100644
--- a/main/sc/BUILD.bazel
+++ b/main/sc/BUILD.bazel
@@ -7,7 +7,7 @@ load("//build/rules:sdi_target.bzl", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/scaddins/BUILD.bazel b/main/scaddins/BUILD.bazel
index 0cf26133da..d00a0d1037 100644
--- a/main/scaddins/BUILD.bazel
+++ b/main/scaddins/BUILD.bazel
@@ -7,7 +7,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "SUPD=680",
diff --git a/main/sccomp/BUILD.bazel b/main/sccomp/BUILD.bazel
index 038c7d3120..36f07d3a45 100644
--- a/main/sccomp/BUILD.bazel
+++ b/main/sccomp/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "SUPD=680",
diff --git a/main/scripting/BUILD.bazel b/main/scripting/BUILD.bazel
index aa43bc83fb..8bb262450d 100644
--- a/main/scripting/BUILD.bazel
+++ b/main/scripting/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/sd/BUILD.bazel b/main/sd/BUILD.bazel
index d997e99159..31dce90a68 100644
--- a/main/sd/BUILD.bazel
+++ b/main/sd/BUILD.bazel
@@ -7,7 +7,7 @@ load("//build/rules:sdi_target.bzl", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/sdext/BUILD.bazel b/main/sdext/BUILD.bazel
index 35d69dae44..61dad4adc2 100644
--- a/main/sdext/BUILD.bazel
+++ b/main/sdext/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/sfx2/BUILD.bazel b/main/sfx2/BUILD.bazel
index 285d9879ce..5003b4fb42 100644
--- a/main/sfx2/BUILD.bazel
+++ b/main/sfx2/BUILD.bazel
@@ -7,7 +7,7 @@ load("//build/rules:sdi_target.bzl", "sdi_package", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/shell/BUILD.bazel b/main/shell/BUILD.bazel
index 3415205f14..40a0e7f998 100644
--- a/main/shell/BUILD.bazel
+++ b/main/shell/BUILD.bazel
@@ -38,7 +38,7 @@ _SHLXT_COPTS = [
 _UNO_DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
diff --git a/main/slideshow/BUILD.bazel b/main/slideshow/BUILD.bazel
index 25a31499c0..ce9fe9f193 100644
--- a/main/slideshow/BUILD.bazel
+++ b/main/slideshow/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/sot/BUILD.bazel b/main/sot/BUILD.bazel
index 3d6f78944f..1e669c7c3e 100644
--- a/main/sot/BUILD.bazel
+++ b/main/sot/BUILD.bazel
@@ -3,7 +3,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "SOT_DLLIMPLEMENTATION",
diff --git a/main/starmath/BUILD.bazel b/main/starmath/BUILD.bazel
index e077f0c856..08b9efe50a 100644
--- a/main/starmath/BUILD.bazel
+++ b/main/starmath/BUILD.bazel
@@ -7,7 +7,7 @@ load("//build/rules:sdi_target.bzl", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/stoc/BUILD.bazel b/main/stoc/BUILD.bazel
index 4a31d3b27a..f9478655a6 100644
--- a/main/stoc/BUILD.bazel
+++ b/main/stoc/BUILD.bazel
@@ -18,7 +18,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
 ]
diff --git a/main/store/BUILD.bazel b/main/store/BUILD.bazel
index 07f3dcf46e..5c8d8f2042 100644
--- a/main/store/BUILD.bazel
+++ b/main/store/BUILD.bazel
@@ -12,7 +12,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/svgio/BUILD.bazel b/main/svgio/BUILD.bazel
index dc567c3d5f..d2113e5e2e 100644
--- a/main/svgio/BUILD.bazel
+++ b/main/svgio/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/svl/BUILD.bazel b/main/svl/BUILD.bazel
index 8a085699f1..376a2d005c 100644
--- a/main/svl/BUILD.bazel
+++ b/main/svl/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/svtools/BUILD.bazel b/main/svtools/BUILD.bazel
index a841f3effd..3e0fe4ea95 100644
--- a/main/svtools/BUILD.bazel
+++ b/main/svtools/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "_HAS_ITERATOR_DEBUGGING=0",
diff --git a/main/svx/BUILD.bazel b/main/svx/BUILD.bazel
index d35ebf3518..729072a18e 100644
--- a/main/svx/BUILD.bazel
+++ b/main/svx/BUILD.bazel
@@ -7,7 +7,7 @@ load("//build/rules:sdi_target.bzl", "sdi_package", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/sw/BUILD.bazel b/main/sw/BUILD.bazel
index f19561b519..29cd183efb 100644
--- a/main/sw/BUILD.bazel
+++ b/main/sw/BUILD.bazel
@@ -7,7 +7,7 @@ load("//build/rules:sdi_target.bzl", "sdi_target")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/test/BUILD.bazel b/main/test/BUILD.bazel
index 9cf802b95c..fb1f1f06ff 100644
--- a/main/test/BUILD.bazel
+++ b/main/test/BUILD.bazel
@@ -13,7 +13,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "SHAREDLIB", "_DLL_",
     "OOO_DLLIMPLEMENTATION_TEST",
     "snprintf=_snprintf",
diff --git a/main/toolkit/BUILD.bazel b/main/toolkit/BUILD.bazel
index 355ea57ec8..5d80d70a3a 100644
--- a/main/toolkit/BUILD.bazel
+++ b/main/toolkit/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/tools/BUILD.bazel b/main/tools/BUILD.bazel
index 039f66c481..7fe0f964a6 100644
--- a/main/tools/BUILD.bazel
+++ b/main/tools/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:gtest_test.bzl", "gtest_test")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "TOOLS_DLLIMPLEMENTATION",
@@ -251,7 +251,7 @@ gtest_test(
     defines = [
         "WNT", "GUI", "WIN32",
         "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-        "CPPU_ENV=msci", "INTEL", "_X86_=1",
+        "CPPU_ENV=msci", 
         "snprintf=_snprintf",
     ],
     deps = [
diff --git a/main/ucb/BUILD.bazel b/main/ucb/BUILD.bazel
index bba6c8f6a3..8eed1dd828 100644
--- a/main/ucb/BUILD.bazel
+++ b/main/ucb/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/ucbhelper/BUILD.bazel b/main/ucbhelper/BUILD.bazel
index dc0272c58c..8a752965b2 100644
--- a/main/ucbhelper/BUILD.bazel
+++ b/main/ucbhelper/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "UCBHELPER_DLLIMPLEMENTATION",
diff --git a/main/unotools/BUILD.bazel b/main/unotools/BUILD.bazel
index 58737926f2..6622bc0dd2 100644
--- a/main/unotools/BUILD.bazel
+++ b/main/unotools/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "UNOTOOLS_DLLIMPLEMENTATION",
diff --git a/main/unoxml/BUILD.bazel b/main/unoxml/BUILD.bazel
index b0dc323e65..7e1f2e5606 100644
--- a/main/unoxml/BUILD.bazel
+++ b/main/unoxml/BUILD.bazel
@@ -3,7 +3,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/uui/BUILD.bazel b/main/uui/BUILD.bazel
index 61e8bcd79d..8c8fc92333 100644
--- a/main/uui/BUILD.bazel
+++ b/main/uui/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/vbahelper/BUILD.bazel b/main/vbahelper/BUILD.bazel
index 85eac21689..400db0f8f9 100644
--- a/main/vbahelper/BUILD.bazel
+++ b/main/vbahelper/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/vcl/BUILD.bazel b/main/vcl/BUILD.bazel
index 02231bc41c..8cbae9417b 100644
--- a/main/vcl/BUILD.bazel
+++ b/main/vcl/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/vos/BUILD.bazel b/main/vos/BUILD.bazel
index 272db44eb4..2530658710 100644
--- a/main/vos/BUILD.bazel
+++ b/main/vos/BUILD.bazel
@@ -12,7 +12,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "INTEL", "_X86_=1",
+    
     "SHAREDLIB", "_DLL_",
     "VOS_DLLIMPLEMENTATION",
 ]
diff --git a/main/winaccessibility/BUILD.bazel b/main/winaccessibility/BUILD.bazel
index 98a56a5eb3..17b495bd9c 100644
--- a/main/winaccessibility/BUILD.bazel
+++ b/main/winaccessibility/BUILD.bazel
@@ -13,7 +13,7 @@ _ATL_REQUIRED = select({
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/writerfilter/BUILD.bazel b/main/writerfilter/BUILD.bazel
index 0caccb8923..61e1c4d7a6 100644
--- a/main/writerfilter/BUILD.bazel
+++ b/main/writerfilter/BUILD.bazel
@@ -8,7 +8,7 @@ load(":ooxml_ns_rules.bzl", "OOXML_NS", "ooxml_ns_factory_rules")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
     "snwprintf=_snwprintf",
diff --git a/main/xmlhelp/BUILD.bazel b/main/xmlhelp/BUILD.bazel
index bf1cae4a45..438d14c38f 100644
--- a/main/xmlhelp/BUILD.bazel
+++ b/main/xmlhelp/BUILD.bazel
@@ -16,7 +16,7 @@ exports_files(glob([
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/xmloff/BUILD.bazel b/main/xmloff/BUILD.bazel
index 8a07cdd65c..8d934155e4 100644
--- a/main/xmloff/BUILD.bazel
+++ b/main/xmloff/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]
diff --git a/main/xmlreader/BUILD.bazel b/main/xmlreader/BUILD.bazel
index 2eb72067f8..c38b4d0445 100644
--- a/main/xmlreader/BUILD.bazel
+++ b/main/xmlreader/BUILD.bazel
@@ -12,7 +12,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
diff --git a/main/xmlscript/BUILD.bazel b/main/xmlscript/BUILD.bazel
index ce2f257eaf..ba6338f446 100644
--- a/main/xmlscript/BUILD.bazel
+++ b/main/xmlscript/BUILD.bazel
@@ -5,7 +5,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     "SHAREDLIB", "_DLL_",
     "XCR_DLLIMPLEMENTATION",
diff --git a/main/xmlsecurity/BUILD.bazel b/main/xmlsecurity/BUILD.bazel
index 7a09e56a41..fee63d9325 100644
--- a/main/xmlsecurity/BUILD.bazel
+++ b/main/xmlsecurity/BUILD.bazel
@@ -6,7 +6,7 @@ load("//build/rules:rsc_pipeline.bzl", "rsc_res")
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK", "SHAREDLIB", "_DLL_",
     "snprintf=_snprintf",
 ]


(openoffice) 19/20: sal/vcl: Win64 (x64) runtime source fixes -- thread key + window pointers

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 1ac44d4c16cd8c7fb00879e708b1c066c88ccc26
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Sat Jul 25 10:47:53 2026 +0200

    sal/vcl: Win64 (x64) runtime source fixes -- thread key + window pointers
    
    Pointer-width fixes on the runtime boot path (all compile unchanged on x86;
    dmake-backportable):
    
    - sal osl/thread.h: oslThreadKey sal_uInt32 -> sal_uIntPtr.  The w32
      osl_createThreadKey returns a heap PTLS* stuffed into the key; on LLP64 that
      64-bit pointer was truncated, so osl_getThreadKeyData dereferenced garbage
      (first crash: cppu getIdContainer during InitVCL).  Not present in
      origin/windows-amd64 (their thread.h/.c match trunk) -- authored here.
    - vcl win/saldata: ImplSet/GetWindowLong -> LONG_PTR + Set/GetWindowLongPtrW,
      SetWindowPtr/SetSalObjWindowPtr (LONG)->(LONG_PTR) (frame pointer stored in the
      window's extra bytes was truncated -> sign-extended garbage in
      UpdateFrameGeometry) (ref 9b64d14c8d); SAL_FRAME/OBJECT_WNDEXTRA sizeof(DWORD)
      -> sizeof(ULONG_PTR) so the 8-byte pointer fits the reserve (added beyond the
      reference, which relied on Windows over-allocating); ImplSendMessage BOOL ->
      LRESULT (WinSalInstance::CreateFrame/CreateObject route the new
      SalFrame*/SalObject* back as the SAL_MSG_CREATE* message result -- BOOL
      truncated it, causing an AV in SalFrame::SetCallback; also fixes the latent
      HDC/HWND truncations at the other call sites).
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit cc0a3ed6d1e1f10040e030b974c4b0ab9c6fbf17)
---
 main/sal/inc/osl/thread.h           |  7 ++++++-
 main/vcl/inc/win/saldata.hxx        | 18 +++++++++++-------
 main/vcl/win/source/app/saldata.cxx | 18 +++++++++++-------
 3 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/main/sal/inc/osl/thread.h b/main/sal/inc/osl/thread.h
index 0378f53717..8009403730 100644
--- a/main/sal/inc/osl/thread.h
+++ b/main/sal/inc/osl/thread.h
@@ -63,7 +63,12 @@ typedef enum
 
 typedef sal_uInt32 oslThreadIdentifier;
 
-typedef sal_uInt32 oslThreadKey;
+/* oslThreadKey holds a pointer (the w32 impl returns a PTLS*, the unx impl a
+ * pthread_key_t/index); it MUST be pointer-width or the w32 osl_createThreadKey
+ * pointer is truncated on Win64 (LLP64) → osl_getThreadKeyData derefs a bad
+ * pointer and crashes (first seen: cppu getIdContainer during InitVCL).
+ * sal_uIntPtr == sal_uInt32 on x86 (unchanged) / sal_uInt64 on x64. */
+typedef sal_uIntPtr oslThreadKey;
 
 /** Create the thread, using the function-ptr pWorker as
 	its main (worker) function. This functions receives in
diff --git a/main/vcl/inc/win/saldata.hxx b/main/vcl/inc/win/saldata.hxx
index 8c40b816ad..a10e79ac2a 100644
--- a/main/vcl/inc/win/saldata.hxx
+++ b/main/vcl/inc/win/saldata.hxx
@@ -253,14 +253,18 @@ int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 );
 // - Defines -
 // -----------
 
-#define SAL_FRAME_WNDEXTRA          sizeof( DWORD )
+/* Extra window bytes hold the WinSalFrame* (SAL_FRAME_THIS, offset 0) via
+ * Set/GetWindowLongPtr — so the reserve MUST be pointer-width, else the 8-byte
+ * store on Win64 overruns a 4-byte reserve.  sizeof(ULONG_PTR) == 4 on x86
+ * (unchanged) / 8 on x64. */
+#define SAL_FRAME_WNDEXTRA          sizeof( ULONG_PTR )
 #define SAL_FRAME_THIS              0
 #define SAL_FRAME_CLASSNAMEA        "SALFRAME"
 #define SAL_FRAME_CLASSNAMEW        L"SALFRAME"
 #define SAL_SUBFRAME_CLASSNAMEA     "SALSUBFRAME"
 #define SAL_SUBFRAME_CLASSNAMEW     L"SALSUBFRAME"
 #define SAL_TMPSUBFRAME_CLASSNAMEW  L"SALTMPSUBFRAME"
-#define SAL_OBJECT_WNDEXTRA         sizeof( DWORD )
+#define SAL_OBJECT_WNDEXTRA         sizeof( ULONG_PTR )
 #define SAL_OBJECT_THIS             0
 #define SAL_OBJECT_CLASSNAMEA       "SALOBJECT"
 #define SAL_OBJECT_CLASSNAMEW       L"SALOBJECT"
@@ -344,17 +348,17 @@ int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 );
 // -----------------
 
 // A/W-Wrapper
-LONG        ImplSetWindowLong( HWND hWnd, int nIndex, DWORD dwNewLong );
-LONG        ImplGetWindowLong( HWND hWnd, int nIndex );
+LONG_PTR        ImplSetWindowLong( HWND hWnd, int nIndex, LONG_PTR newLong );
+LONG_PTR        ImplGetWindowLong( HWND hWnd, int nIndex );
 BOOL    ImplPostMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam );
-BOOL    ImplSendMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam );
+LRESULT ImplSendMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam );
 BOOL    ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax );
 BOOL    ImplPeekMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg );
 LONG        ImplDispatchMessage( CONST MSG *lpMsg );
 
 inline void SetWindowPtr( HWND hWnd, WinSalFrame* pThis )
 {
-    ImplSetWindowLong( hWnd, SAL_FRAME_THIS, (LONG)pThis );
+    ImplSetWindowLong( hWnd, SAL_FRAME_THIS, (LONG_PTR)pThis );
 }
 
 inline WinSalFrame* GetWindowPtr( HWND hWnd )
@@ -364,7 +368,7 @@ inline WinSalFrame* GetWindowPtr( HWND hWnd )
 
 inline void SetSalObjWindowPtr( HWND hWnd, WinSalObject* pThis )
 {
-    ImplSetWindowLong( hWnd, SAL_OBJECT_THIS, (LONG)pThis );
+    ImplSetWindowLong( hWnd, SAL_OBJECT_THIS, (LONG_PTR)pThis );
 }
 
 inline WinSalObject* GetSalObjWindowPtr( HWND hWnd )
diff --git a/main/vcl/win/source/app/saldata.cxx b/main/vcl/win/source/app/saldata.cxx
index f643f07cf7..b95c08d4ce 100644
--- a/main/vcl/win/source/app/saldata.cxx
+++ b/main/vcl/win/source/app/saldata.cxx
@@ -114,16 +114,16 @@ int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 )
 
 // =======================================================================
 
-LONG ImplSetWindowLong( HWND hWnd, int nIndex, DWORD dwNewLong )
+LONG_PTR ImplSetWindowLong( HWND hWnd, int nIndex, LONG_PTR newLong )
 {
-	return SetWindowLongW( hWnd, nIndex, dwNewLong );
+	return SetWindowLongPtrW( hWnd, nIndex, newLong );
 }
 
 // -----------------------------------------------------------------------
 
-LONG ImplGetWindowLong( HWND hWnd, int nIndex )
+LONG_PTR ImplGetWindowLong( HWND hWnd, int nIndex )
 {
-	return GetWindowLongW( hWnd, nIndex );
+	return GetWindowLongPtrW( hWnd, nIndex );
 }
 
 // -----------------------------------------------------------------------
@@ -135,10 +135,14 @@ BOOL ImplPostMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
 
 // -----------------------------------------------------------------------
 
-BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+/* MUST return LRESULT (LONG_PTR), not BOOL: WinSalInstance::CreateFrame /
+ * CreateObject route the new SalFrame / SalObject pointer back as the
+ * SAL_MSG_CREATE* message result (an LRESULT).  Truncating that to 32-bit BOOL
+ * loses the high pointer bits on Win64 -> the caller derefs a truncated frame
+ * (AV in SalFrame::SetCallback during InitVCL/splash). */
+LRESULT ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
 {
-	BOOL bRet = SendMessageW( hWnd, nMsg, wParam, lParam );
-    return bRet;
+	return SendMessageW( hWnd, nMsg, wParam, lParam );
 }
 
 // -----------------------------------------------------------------------


(openoffice) 06/20: update externals to the new modern linker.

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 94a0c9a38670e0f591b97c9d63b5d7e4c07d056b
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Fri Jul 3 00:24:35 2026 +0200

    update externals to the new modern linker.
---
 ext_libraries/modules/curl/8.7.1/overlay/BUILD.bazel                | 5 +++++
 ext_libraries/modules/curl/8.7.1/source.json                        | 2 +-
 ext_libraries/modules/mariadb-connector-c/2.3.7/overlay/BUILD.bazel | 5 +++++
 ext_libraries/modules/mariadb-connector-c/2.3.7/source.json         | 2 +-
 ext_libraries/modules/openssl/3.0.13/overlay/BUILD.bazel            | 5 +++++
 ext_libraries/modules/openssl/3.0.13/source.json                    | 2 +-
 6 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/ext_libraries/modules/curl/8.7.1/overlay/BUILD.bazel b/ext_libraries/modules/curl/8.7.1/overlay/BUILD.bazel
index 15e3e7f7b5..d182e7e5d4 100644
--- a/ext_libraries/modules/curl/8.7.1/overlay/BUILD.bazel
+++ b/ext_libraries/modules/curl/8.7.1/overlay/BUILD.bazel
@@ -19,6 +19,11 @@ cmake(
     name = "curl",
     lib_source = ":all_srcs",
     deps = ["@openssl//:ssl"],
+    # Drop the generate_pdb feature: it emits /DEBUG:FASTLINK for the native
+    # modern-linker path, but rules_foreign_cc links with VC9 link.exe, which
+    # predates FASTLINK (VS2015+) and fails LNK1117. External deps are Release
+    # and need no PDB, so keep that flag out of the generated CMake toolchain.
+    features = ["-generate_pdb"],
     cache_entries = {
         # Static build
         "BUILD_SHARED_LIBS": "OFF",
diff --git a/ext_libraries/modules/curl/8.7.1/source.json b/ext_libraries/modules/curl/8.7.1/source.json
index e127bcb619..7ebd18b95e 100644
--- a/ext_libraries/modules/curl/8.7.1/source.json
+++ b/ext_libraries/modules/curl/8.7.1/source.json
@@ -4,6 +4,6 @@
     "url": "https://github.com/curl/curl/releases/download/curl-8_7_1/curl-8.7.1.tar.gz",
     "overlay": {
         "MODULE.bazel": "sha256-KJDj4DF6WRv0VqCvA7OEaLuQ1aMHrncAP6RnDbawlzQ=",
-        "BUILD.bazel": "sha256-r7wYRQvTi/xtMjwr0NY6+JWFx3LG0AsHra9b+f0AncI="
+        "BUILD.bazel": "sha256-kOxkg1HWUuJyBcVV/4dTL8ziWwhQB+AwfIC9HHjSArI="
     }
 }
diff --git a/ext_libraries/modules/mariadb-connector-c/2.3.7/overlay/BUILD.bazel b/ext_libraries/modules/mariadb-connector-c/2.3.7/overlay/BUILD.bazel
index b254487a09..6a47915df3 100644
--- a/ext_libraries/modules/mariadb-connector-c/2.3.7/overlay/BUILD.bazel
+++ b/ext_libraries/modules/mariadb-connector-c/2.3.7/overlay/BUILD.bazel
@@ -19,6 +19,11 @@ filegroup(
 cmake(
     name = "mariadb",
     lib_source = ":all_srcs",
+    # Drop the generate_pdb feature: it emits /DEBUG:FASTLINK for the native
+    # modern-linker path, but rules_foreign_cc links with VC9 link.exe, which
+    # predates FASTLINK (VS2015+) and fails LNK1117. External deps are Release
+    # and need no PDB, so keep that flag out of the generated CMake toolchain.
+    features = ["-generate_pdb"],
     cache_entries = {
         # No SSL required for the SDBC driver layer
         "WITH_OPENSSL": "OFF",
diff --git a/ext_libraries/modules/mariadb-connector-c/2.3.7/source.json b/ext_libraries/modules/mariadb-connector-c/2.3.7/source.json
index b378c5666f..45a5a1aba0 100644
--- a/ext_libraries/modules/mariadb-connector-c/2.3.7/source.json
+++ b/ext_libraries/modules/mariadb-connector-c/2.3.7/source.json
@@ -4,7 +4,7 @@
     "url": "https://github.com/mariadb-corporation/mariadb-connector-c/archive/refs/tags/v_2.3.7.zip",
     "overlay": {
         "MODULE.bazel": "sha256-k8HuYIOryCL/xPZJdE4jzfOgPckyuwdb0X32/fXQQBg=",
-        "BUILD.bazel": "sha256-OVob1l2pmNHv2rCNh/2Zu1HyW46WxLh7c/nzEQos4JA=",
+        "BUILD.bazel": "sha256-FWvitwP4+4xYO2svWzKi83NK7r//RX/BsnQmuOGkUjg=",
         "cmake/ConnectorName.cmake": "sha256-sgj29Y82ZTI7o2sd8HSD4rK5qDVdSt4i6tQURxsjF38=",
         "include/mysql.h": "sha256-qtgc1JL8x00XMpYJbQCGW5C5ybs+BmfrybVJmB+3uwQ=",
         "include/errmsg.h": "sha256-Re4nkCLtV2B82L51S05FcLiWCztmA0g6dMvP9xiNGfU="
diff --git a/ext_libraries/modules/openssl/3.0.13/overlay/BUILD.bazel b/ext_libraries/modules/openssl/3.0.13/overlay/BUILD.bazel
index 33b5f6846d..c5b7f47053 100644
--- a/ext_libraries/modules/openssl/3.0.13/overlay/BUILD.bazel
+++ b/ext_libraries/modules/openssl/3.0.13/overlay/BUILD.bazel
@@ -22,6 +22,11 @@ filegroup(
 configure_make_variant(
     name = "ssl",
     visibility = ["//visibility:public"],
+    # Drop the generate_pdb feature: it emits /DEBUG:FASTLINK for the native
+    # modern-linker path, but rules_foreign_cc builds link with VC9 link.exe,
+    # which predates FASTLINK (VS2015+) and fails LNK1117. External deps are
+    # Release and need no PDB, so keep that flag out of their link flags.
+    features = ["-generate_pdb"],
     toolchain = "@rules_foreign_cc//toolchains:preinstalled_nmake_toolchain",
     lib_source = ":all_srcs",
     build_data = ["@strawberry-perl//:perl_exe"],
diff --git a/ext_libraries/modules/openssl/3.0.13/source.json b/ext_libraries/modules/openssl/3.0.13/source.json
index 1bf12294c1..91b7738aa6 100644
--- a/ext_libraries/modules/openssl/3.0.13/source.json
+++ b/ext_libraries/modules/openssl/3.0.13/source.json
@@ -4,7 +4,7 @@
   "strip_prefix": "openssl-3.0.13",
   "overlay": {
     "MODULE.bazel": "sha256-LIe7ROIfVim3leVjQi6CL5SuFiDZ/iCveLqSNLqyXG8=",
-    "BUILD.bazel": "sha256-kXXbxUOysk3Al6DLEFczsPesYA2tZTOqVFZrYyfccKA=",
+    "BUILD.bazel": "sha256-QFlvHAVciVnlngWR8enBEJu2K2GUOE3Xd+xsKStURUA=",
     "configure.sh": "sha256-vfynN+p+3b09VtyAhYodn3vmycV7iIDWaYoyf26qtHQ="
   }
 }


(openoffice) 08/20: build/win64: add x64 (VC9 cross) toolchain, platforms, and arch selection [P1]

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 1695372c6b058ea4ff1d31b25bcf6981c9d17f61
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Tue Jul 21 12:14:06 2026 +0200

    build/win64: add x64 (VC9 cross) toolchain, platforms, and arch selection [P1]
    
    Adds a Windows x86-64 build alongside the existing x86 build; x86 stays the
    default and is unchanged.
    
    - windows_cc_toolchain_config.bzl: parameterize the shared MSVC config on arch
      via three new attrs — masm_flags (x64 ml64 takes /c only; x86 keeps /c /coff
      /Cx), pdb_link_flags (x64 drops the x86-only /SAFESEH:NO), and arch_defines
      (per-arch CPU defines injected globally into default_compile_flags_list).
    - toolchain/BUILD.bazel: add the x64 cc_toolchain(+config+toolchain) using the
      x86_amd64 cross cl/ml64/link, VC\bin\amd64\lib.exe, SDK\lib\x64 + VC\LIB\amd64,
      /MACHINE:X64.  Inject arch_defines: x86 -> _X86_=1/INTEL, x64 -> _AMD64_=1/X86_64
      (WIN32 stays on both; the compiler auto-defines _WIN64).  Fix the latent
      constraint bug: the x86 toolchain now targets @platforms//cpu:x86_32 (was
      wrongly x86_64); x64 targets x86_64.
    - vs_config_repo.bzl: parameterize modern-linker discovery on target arch and
      expose PDB_LINK_X64 (Host*\x64) for the x64 generate_pdb path.
    - build/platforms: windows_x86 (cpu:x86_32) / windows_x64 (cpu:x86_64).
    - build/BUILD.bazel: //build:arch_x86 / //build:arch_x64 config_settings.
    - .bazelrc: --config=x86 (default) / --config=x64, each pinning --platforms +
      a distinct --platform_suffix + --symlink_prefix so both output trees coexist.
    - MODULE.bazel: register the x64 toolchain; register windows_x64 then windows_x86
      as execution platforms (x64 host runs x86_32 via WOW64) so x86 test targets
      resolve a test toolchain while cc/exec-tool actions stay on x64.
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit cfc239c90d48d85d0707693b2adfa1612cfe1241)
---
 .bazelrc                                        |  21 +++-
 MODULE.bazel                                    |  20 ++++
 build/BUILD.bazel                               |  17 +++
 build/platforms/BUILD.bazel                     |  26 +++++
 build/toolchain/BUILD.bazel                     | 138 +++++++++++++++++++++++-
 build/toolchain/windows_cc_toolchain_config.bzl |  26 ++++-
 build/vs_config_repo.bzl                        |  14 ++-
 7 files changed, 252 insertions(+), 10 deletions(-)

diff --git a/.bazelrc b/.bazelrc
index fb189cb300..6c308e625c 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -7,4 +7,23 @@ common --enable_bzlmod
 common --check_direct_dependencies=off
 
 common --registry="file:///%workspace%/ext_libraries"
-common --registry=https://bcr.bazel.build
\ No newline at end of file
+common --registry=https://bcr.bazel.build
+
+# ---------------------------- Architecture (x86 / x64) ----------------------------
+# x86 is the DEFAULT build (a plain `bazel build` = 32-bit).  Now that the x86
+# toolchain correctly targets @platforms//cpu:x86_32, the target platform must be
+# pinned explicitly (the auto host platform is x86_64 and would not resolve it).
+# Each arch pins --platforms + a distinct --platform_suffix (separate bazel-out
+# trees, no clobber) + --symlink_prefix (both convenience symlinks coexist).
+# --config=x64 overrides these x86 defaults (all three are last-value-wins).
+build --platforms=//build/platforms:windows_x86
+build --platform_suffix=x86
+build --symlink_prefix=bazel-x86-
+
+build:x86 --platforms=//build/platforms:windows_x86
+build:x86 --platform_suffix=x86
+build:x86 --symlink_prefix=bazel-x86-
+
+build:x64 --platforms=//build/platforms:windows_x64
+build:x64 --platform_suffix=x64
+build:x64 --symlink_prefix=bazel-x64-
\ No newline at end of file
diff --git a/MODULE.bazel b/MODULE.bazel
index c88ab6f9b4..68d76092fa 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -68,6 +68,26 @@ http_file(
 )
 
 register_toolchains("//build/toolchain:cc_toolchain_x86_vs2008_def")
+register_toolchains("//build/toolchain:cc_toolchain_x64_vs2008_def")
+
+# Execution platforms.  ORDER MATTERS — register_execution_platforms prepends, so the
+# FIRST entry is the highest-priority exec platform.
+#   windows_x64 (x86_64) MUST be first: it becomes the exec platform for all build
+#     actions and cfg="exec" tools (idlc/regmerge/cppumaker/rsc/…), so those tools are
+#     built x64 and run natively on this x64 host (matching the amd64 CRT staging).
+#     A target that requires no cc toolchain (e.g. idl_library, which just runs the
+#     staged tools) picks the first exec platform outright — if windows_x86 were first,
+#     those tools would be built x86_32 (breaking the x64 regmerge/idlc link + CRT).
+#   windows_x86 (x86_32) is the fallback: this x64 host also runs 32-bit binaries via
+#     WOW64, so x86 TEST targets (target cpu:x86_32) resolve their test toolchain here
+#     (Bazel runs tests on an exec platform matching the target's constraints; without
+#     this, x86 `bazel test` fails "no matching default_test_toolchain_type").  Only the
+#     test-run action lands here — cc/exec-tool actions need a cc toolchain, which is
+#     exec_compatible_with x86_64 only, so they never select windows_x86.
+register_execution_platforms(
+    "//build/platforms:windows_x64",
+    "//build/platforms:windows_x86",
+)
 # Use preinstalled pkg-config instead of building it from source (building it
 # from source requires gettext_runtime whose BUILD uses a removed cc_import builtin).
 register_toolchains("@rules_foreign_cc//toolchains:preinstalled_pkgconfig_toolchain")
diff --git a/build/BUILD.bazel b/build/BUILD.bazel
index 2f89f3de29..ae582df585 100644
--- a/build/BUILD.bazel
+++ b/build/BUILD.bazel
@@ -19,6 +19,23 @@ config_setting(
     visibility = ["//visibility:public"],
 )
 
+# Architecture config_settings for select() in module BUILD files (Win64 Phase 2).
+# Resolved from the target platform's cpu constraint (--config=x86 / --config=x64).
+# The common arch defines (_X86_/INTEL vs _AMD64_/X86_64) are injected by the
+# toolchain, not here; these are for the residual per-module arch conditionals
+# (bridge sources, .def decoration, x64-only libs, etc.).
+config_setting(
+    name = "arch_x86",
+    constraint_values = ["@platforms//cpu:x86_32"],
+    visibility = ["//visibility:public"],
+)
+
+config_setting(
+    name = "arch_x64",
+    constraint_values = ["@platforms//cpu:x86_64"],
+    visibility = ["//visibility:public"],
+)
+
 # Debug-info staging flag — when True, flat_install also copies .pdb files.
 # Complement with --compilation_mode=dbg (or --features=generate_pdb_file) so
 # the toolchain actually produces PDB files; without that flag the .pdb output
diff --git a/build/platforms/BUILD.bazel b/build/platforms/BUILD.bazel
new file mode 100644
index 0000000000..1d9a9b88ae
--- /dev/null
+++ b/build/platforms/BUILD.bazel
@@ -0,0 +1,26 @@
+# Target platforms for the dual-arch Windows build.
+# Selected via --platforms (wired to --config=x86 / --config=x64 in .bazelrc);
+# the target cpu constraint picks which //build/toolchain cc_toolchain resolves.
+#
+#   windows_x86 → @platforms//cpu:x86_32 → cc_toolchain_x86_vs2008 (default build)
+#   windows_x64 → @platforms//cpu:x86_64 → cc_toolchain_x64_vs2008 (Win64 build)
+#
+# The exec (host) platform stays Bazel's auto-detected x64 Windows host for both.
+
+platform(
+    name = "windows_x86",
+    constraint_values = [
+        "@platforms//os:windows",
+        "@platforms//cpu:x86_32",
+    ],
+    visibility = ["//visibility:public"],
+)
+
+platform(
+    name = "windows_x64",
+    constraint_values = [
+        "@platforms//os:windows",
+        "@platforms//cpu:x86_64",
+    ],
+    visibility = ["//visibility:public"],
+)
diff --git a/build/toolchain/BUILD.bazel b/build/toolchain/BUILD.bazel
index 5a244540d0..76c8cd8601 100644
--- a/build/toolchain/BUILD.bazel
+++ b/build/toolchain/BUILD.bazel
@@ -1,8 +1,17 @@
 load("@rules_cc//cc/toolchains:cc_toolchain.bzl", "cc_toolchain")
 load(":windows_cc_toolchain_config.bzl", "cc_toolchain_config")
-load("@vs_config//:paths.bzl", _VS = "VS", _VC = "VC", _SDK = "SDK", _MSVC_TMP = "MSVC_TMP", _LINK_WRAPPER = "LINK_WRAPPER", _PDB_LINK = "PDB_LINK")
+load("@vs_config//:paths.bzl", _VS = "VS", _VC = "VC", _SDK = "SDK", _MSVC_TMP = "MSVC_TMP", _LINK_WRAPPER = "LINK_WRAPPER", _PDB_LINK = "PDB_LINK", _PDB_LINK_X64 = "PDB_LINK_X64")
 
-# VS2008 x86 toolchain for Apache OpenOffice on Windows
+# VS2008 toolchains for Apache OpenOffice on Windows.
+# Two targets share one windows_cc_toolchain_config.bzl, parameterized by arch:
+#   * x86 (cc_toolchain_x86_vs2008) — the default build, VC\bin\{cl,ml,link}.exe,
+#     SDK\lib + VC\LIB, /MACHINE:X86, ml /coff /Cx.  Targets @platforms//cpu:x86_32.
+#   * x64 (cc_toolchain_x64_vs2008) — the Win64 build, VC\bin\x86_amd64 cross tools
+#     (cl/ml64/link) + VC\bin\amd64\lib.exe, SDK\lib\x64 + VC\LIB\amd64,
+#     /MACHINE:X64, ml64 /c only.  Targets @platforms//cpu:x86_64.
+# The exec platform for both is this x64 Windows host (@platforms//cpu:x86_64);
+# --platforms=//build/platforms:windows_{x86,x64} (via --config=x86/x64) picks the
+# target arch and thus which toolchain resolves.
 # Paths are configured via --repo_env=VS_PATH / --repo_env=SDK_PATH in user.bazelrc.
 
 filegroup(name = "empty", srcs = [])
@@ -70,6 +79,9 @@ cc_toolchain_config(
     },
     archiver_flags         = ["/MACHINE:X86"],
     default_link_flags     = ["/MACHINE:X86"],
+    # Per-arch CPU defines injected globally (Win64 Phase 2) so no module BUILD
+    # carries an arch flag.  x86 → _X86_=1, INTEL.  WIN32 stays in the modules.
+    arch_defines           = ["_X86_=1", "INTEL"],
     dbg_mode_debug_flag      = "",   # /Z7 embeds debug info in objects at compile; linker PDB (/DEBUG via --features=generate_pdb) uses the per-action mspdbsrv wrapper above for parallel links
     fastbuild_mode_debug_flag = "",  # same — /Z7 embeds, no compile-time PDB
     supports_parse_showincludes = False,
@@ -97,13 +109,133 @@ cc_toolchain(
 toolchain(
     name = "cc_toolchain_x86_vs2008_def",
     exec_compatible_with = [
+        # Exec = this x64 Windows host.
         "@platforms//cpu:x86_64",
         "@platforms//os:windows",
     ],
     target_compatible_with = [
-        "@platforms//cpu:x86_64",
+        # FIX: the x86 toolchain builds 32-bit binaries, so its TARGET cpu is
+        # x86_32 — not x86_64 as it wrongly declared before.  Resolved against
+        # //build/platforms:windows_x86 (--config=x86, the default).
+        "@platforms//cpu:x86_32",
         "@platforms//os:windows",
     ],
     toolchain      = ":cc_toolchain_x86_vs2008",
     toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
 )
+
+# ============================ x64 (Win64) toolchain ============================
+
+cc_toolchain_config(
+    name = "vs2008_x64_config",
+    cpu = "x64_windows",  # MSVC toolchain-config selector (not the platform cpu)
+    compiler = "msvc-cl",
+    host_system_name = "local",
+    target_system_name = "local",
+    target_libc = "msvcrt",
+    abi_version = "local",
+    abi_libc_version = "local",
+    toolchain_identifier = "msvc_x64_vs2008",
+    msvc_env_tmp  = _MSVC_TMP,
+    # PATH: the x86_amd64 CROSS cl/link (host-x86, target-x64) resolve their own
+    # c1/c2 DLLs from their dir, but mspdb/1033 live in VC\BIN — so both dirs are
+    # on PATH.  amd64\ (native x64 tools, e.g. lib.exe) is also on PATH.
+    msvc_env_path = (
+        _SDK + "\\bin;" +
+        _VS  + "\\Common7\\IDE;" +
+        _VC  + "\\BIN\\x86_amd64;" +
+        _VC  + "\\BIN\\amd64;" +
+        _VC  + "\\BIN;" +
+        _VS  + "\\Common7\\Tools"
+    ),
+    # Headers are arch-neutral — same INCLUDE as x86.
+    msvc_env_include = (
+        _SDK + "\\include;" +
+        _VC  + "\\ATLMFC\\INCLUDE;" +
+        _VC  + "\\INCLUDE"
+    ),
+    # LIB is the x64 variant: SDK\lib\x64 + VC\...\amd64.
+    msvc_env_lib = (
+        _SDK + "\\lib\\x64;" +
+        _VC  + "\\ATLMFC\\LIB\\amd64;" +
+        _VC  + "\\LIB\\amd64"
+    ),
+    tool_bin_path  = _VC + "\\bin\\x86_amd64",
+    msvc_cl_path   = _VC + "\\bin\\x86_amd64\\cl.exe",
+    msvc_ml_path   = _VC + "\\bin\\x86_amd64\\ml64.exe",
+    # x64 generate_pdb path uses an x64-target modern link.exe (Host*\x64).
+    pdb_link_path  = _PDB_LINK_X64,
+    # Default (non-PDB) links use the x86_amd64 cross link.exe directly.  The
+    # mspdbsrv-endpoint wrapper (LINK_WRAPPER) is x86-link-specific and only
+    # matters for parallel /DEBUG PDB writes, which the default /Z7-embed build
+    # does not do — so x64 skips it.  (If x64 debug PDB builds later hit LNK1318,
+    # generate an x64 wrapper in vs_config_repo.bzl and point this there.)
+    msvc_link_path = _VC + "\\bin\\x86_amd64\\link.exe",
+    # x86_amd64\ has no lib.exe; use the native amd64 archiver (runs on this x64 host).
+    msvc_lib_path  = _VC + "\\bin\\amd64\\lib.exe",
+    cxx_builtin_include_directories = [
+        _SDK + "\\include",
+        _VC  + "\\ATLMFC\\INCLUDE",
+        _VC  + "\\INCLUDE",
+    ],
+    tool_paths = {
+        "ar":      _VC + "\\bin\\amd64\\lib.exe",
+        "cpp":     _VC + "\\bin\\x86_amd64\\cl.exe",
+        "gcc":     _VC + "\\bin\\x86_amd64\\cl.exe",
+        "gcov":    "wrapper/bin/msvc_nop.bat",
+        # Forward slashes required (rules_foreign_cc paths.dirname only splits '/').
+        "ld": (_VC + "\\bin\\x86_amd64\\link.exe").replace("\\", "/"),
+        "ml":      _VC + "\\bin\\x86_amd64\\ml64.exe",
+        "nm":      "wrapper/bin/msvc_nop.bat",
+        "objcopy": "wrapper/bin/msvc_nop.bat",
+        "objdump": "wrapper/bin/msvc_nop.bat",
+        "strip":   "wrapper/bin/msvc_nop.bat",
+    },
+    archiver_flags         = ["/MACHINE:X64"],
+    default_link_flags     = ["/MACHINE:X64"],
+    # Per-arch CPU defines injected globally (Win64 Phase 2).  x64 → _AMD64_=1,
+    # X86_64.  WIN32 stays in the modules; the x64 compiler auto-defines _WIN64.
+    arch_defines           = ["_AMD64_=1", "X86_64"],
+    # ml64 rejects the x86 /coff and /Cx flags — assemble with /c only.
+    masm_flags             = ["/c"],
+    # x64 has no SafeSEH — drop /SAFESEH:NO from the generate_pdb link.
+    pdb_link_flags         = ["/DEBUG:FASTLINK"],
+    dbg_mode_debug_flag       = "",
+    fastbuild_mode_debug_flag = "",
+    supports_parse_showincludes = False,
+    all_compile_flags = [],
+    conly_flags       = [],
+    cxx_flags         = [],
+    link_flags        = [],
+)
+
+cc_toolchain(
+    name = "cc_toolchain_x64_vs2008",
+    toolchain_identifier = "msvc_x64_vs2008",
+    toolchain_config     = ":vs2008_x64_config",
+    all_files      = ":empty",
+    ar_files       = ":empty",
+    as_files       = ":empty",
+    compiler_files = ":empty",
+    dwp_files      = ":empty",
+    linker_files   = ":empty",
+    objcopy_files  = ":empty",
+    strip_files    = ":empty",
+    supports_param_files = 1,
+)
+
+toolchain(
+    name = "cc_toolchain_x64_vs2008_def",
+    exec_compatible_with = [
+        # Exec = this x64 Windows host.
+        "@platforms//cpu:x86_64",
+        "@platforms//os:windows",
+    ],
+    target_compatible_with = [
+        # Target = Win64.  Resolved against //build/platforms:windows_x64 (--config=x64).
+        "@platforms//cpu:x86_64",
+        "@platforms//os:windows",
+    ],
+    toolchain      = ":cc_toolchain_x64_vs2008",
+    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
+)
diff --git a/build/toolchain/windows_cc_toolchain_config.bzl b/build/toolchain/windows_cc_toolchain_config.bzl
index 9f17165cb6..abf9eda0f5 100644
--- a/build/toolchain/windows_cc_toolchain_config.bzl
+++ b/build/toolchain/windows_cc_toolchain_config.bzl
@@ -837,6 +837,20 @@ def _impl(ctx):
         if ctx.attr.win32_winnt_flag:
             default_compile_flags_list.append(ctx.attr.win32_winnt_flag)
 
+        # Per-arch CPU defines, injected globally like _HAS_ITERATOR_DEBUGGING=0
+        # above so no per-module BUILD file carries an arch flag (Win64 Phase 2).
+        #   x86 → _X86_=1, INTEL      x64 → _AMD64_=1, X86_64
+        # (WIN32/WNT/GUI stay in the module BUILDs — they're arch-neutral on Windows;
+        #  the x64 compiler auto-defines _WIN64, so WIN64 is NOT defined here.)
+        # Values verified against origin/windows-amd64 (settings.mk -D$(CPUNAME) +
+        # wntmsci11.mk/wntmscx.mk), which keeps WIN32 on both arches.
+        for arch_def in ctx.attr.arch_defines:
+            default_compile_flags_list.append("/D" + arch_def)
+
+        # MASM flags differ by arch: the x86 ml.exe takes /c /coff /Cx (/Cx keeps
+        # PUBLIC symbol case, /coff emits COFF).  The x64 ml64.exe REJECTS both
+        # /coff and /Cx (it only emits COFF and preserves case), so the x64
+        # toolchain passes just ["/c"].  Driven by the masm_flags attr.
         masm_flags_feature = feature(
             name = "masm_flags",
             flag_sets = [
@@ -845,7 +859,7 @@ def _impl(ctx):
                         ACTION_NAMES.assemble,
                         ACTION_NAMES.preprocess_assemble,
                     ],
-                    flag_groups = [flag_group(flags = ["/c", "/coff", "/Cx"])],
+                    flag_groups = [flag_group(flags = ctx.attr.masm_flags)],
                 ),
             ],
         )
@@ -1400,7 +1414,9 @@ def _impl(ctx):
                     # table (e.g. ICU's icudt49_dat.obj). SafeSEH is a ship-time
                     # mitigation and these are non-distributed debug binaries, so
                     # disabling it here is harmless and only affects the generate_pdb path.
-                    flag_groups = [flag_group(flags = ["/DEBUG:FASTLINK", "/SAFESEH:NO"])],
+                    # SafeSEH is an x86-only concept; the x64 linker rejects /SAFESEH,
+                    # so the x64 toolchain drops it via the pdb_link_flags attr.
+                    flag_groups = [flag_group(flags = ctx.attr.pdb_link_flags)],
                 ),
             ],
         )
@@ -1820,6 +1836,7 @@ cc_toolchain_config = rule(
     attrs = {
         "abi_libc_version": attr.string(),
         "abi_version": attr.string(),
+        "arch_defines": attr.string_list(default = []),
         "archiver_flags": attr.string_list(default = []),
         "all_compile_flags": attr.string_list(),
         "compiler": attr.string(),
@@ -1851,6 +1868,8 @@ This is only offered as a migration bridge for projects transitioning to rule-ba
         "fastbuild_mode_debug_flag": attr.string(default = ""),
         "host_system_name": attr.string(),
         "link_flags": attr.string_list(),
+        # MASM flags: x86 ml.exe = /c /coff /Cx; x64 ml64.exe = /c only (rejects /coff, /Cx).
+        "masm_flags": attr.string_list(default = ["/c", "/coff", "/Cx"]),
         "msvc_cl_path": attr.string(default = "vc_installation_error.bat"),
         "msvc_env_include": attr.string(default = "msvc_not_found"),
         "msvc_env_lib": attr.string(default = "msvc_not_found"),
@@ -1860,6 +1879,9 @@ This is only offered as a migration bridge for projects transitioning to rule-ba
         "msvc_link_path": attr.string(default = "vc_installation_error.bat"),
         "msvc_ml_path": attr.string(default = "vc_installation_error.bat"),
         "pdb_link_path": attr.string(default = "vc_installation_error.bat"),
+        # generate_pdb linker flags: x86 needs /SAFESEH:NO (modern linker enforces
+        # safeseh on x86); x64 drops it (safeseh is x86-only, x64 link rejects it).
+        "pdb_link_flags": attr.string_list(default = ["/DEBUG:FASTLINK", "/SAFESEH:NO"]),
         "shorten_virtual_includes": attr.bool(default = False),
         "supports_parse_showincludes": attr.bool(),
         "target_libc": attr.string(),
diff --git a/build/vs_config_repo.bzl b/build/vs_config_repo.bzl
index df0fb7dbc8..93ff14d308 100644
--- a/build/vs_config_repo.bzl
+++ b/build/vs_config_repo.bzl
@@ -48,14 +48,18 @@ _DEFAULT_PERL = "C:\\msys64\\usr\\bin\\perl.exe"
 # link.exe for the generate_pdb path (see _find_modern_link / PDB_LINK below).
 _DEFAULT_VS_MODERN = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools"
 
-def _find_modern_link(rctx, vs_modern):
-    """Locate the newest VS2017+ x86-target link.exe under a BuildTools/VS root.
+def _find_modern_link(rctx, vs_modern, target = "x86"):
+    """Locate the newest VS2017+ link.exe (for the given target arch) under a
+    BuildTools/VS root.
 
     The VC9 link.exe cannot write PDBs in parallel (single mspdbsrv, no /FS, the
     LNK1318 bug); LLVM lld-link cannot write PDBs from VC9-era CodeView at all
     ("Stream too short"). A modern MSVC link.exe reads the VC9 /Z7 objects natively
     and its mspdbsrv handles parallel PDB writes, so the generate_pdb link path
     uses it. Returns a placeholder if none is found (only breaks generate_pdb builds).
+
+    target = "x86" or "x64" selects the bin\\Host*\\<target>\\link.exe leaf so the
+    x64 toolchain gets an x64-target modern linker for its own generate_pdb path.
     """
     tools = rctx.path(vs_modern + "\\VC\\Tools\\MSVC")
     if not tools.exists:
@@ -63,7 +67,7 @@ def _find_modern_link(rctx, vs_modern):
     best = None
     for ver in tools.readdir():
         for host in ["Hostx64", "Hostx86"]:
-            link = ver.get_child("bin").get_child(host).get_child("x86").get_child("link.exe")
+            link = ver.get_child("bin").get_child(host).get_child(target).get_child("link.exe")
             if link.exists:
                 if best == None or ver.basename > best[0]:
                     best = (ver.basename, str(link))
@@ -79,7 +83,8 @@ def _vs_config_impl(rctx):
     perl = rctx.os.environ.get("PERL_PATH", _DEFAULT_PERL)
     vs_modern = rctx.os.environ.get("VS_MODERN_PATH", _DEFAULT_VS_MODERN)
     vc   = vs + "\\VC"
-    pdb_link = _find_modern_link(rctx, vs_modern)
+    pdb_link = _find_modern_link(rctx, vs_modern, "x86")
+    pdb_link_x64 = _find_modern_link(rctx, vs_modern, "x64")
     debug_crt = vc + "\\redist\\Debug_NonRedist\\x86\\Microsoft.VC90.DebugCRT"
 
     def q(p):
@@ -150,6 +155,7 @@ def _vs_config_impl(rctx):
         'DEBUG_CRT_DIR = "{}"'.format(q(debug_crt)),
         'LINK_WRAPPER = "{}"'.format(q(link_wrapper)),
         'PDB_LINK = "{}"'.format(q(pdb_link)),
+        'PDB_LINK_X64 = "{}"'.format(q(pdb_link_x64)),
         "",
     ])
     rctx.file("paths.bzl", content)


(openoffice) 15/20: crashrep/fpicker/cui: Win64 (x64) source fixes

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit d14d772a5bd66969dee8b8ef850cba39d09a196f
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Fri Jul 24 12:05:26 2026 +0200

    crashrep/fpicker/cui: Win64 (x64) source fixes
    
    Backport the Win64 source fixes from origin/windows-amd64 (dmake-era
    reference); meaningful hunks only -- the reference branch carries heavy
    whitespace churn -- and each compiles unchanged on x86 (dmake-backportable).
    
    - crashrep soreport.cpp (8740daf50e): GWL_ -> GWLP_ + *LongPtr, dialog
      procs BOOL -> INT_PTR, CONTEXT.Eip/Ebp -> Rip/Rbp (guarded by
      INTEL/X86_64), DWORD -> DWORD64 for SymGetSymFromAddr64.
    - fpicker FileOpenDlg + WinFileOpenImpl (73ea0802dd, b077179428): same
      GWL_ -> GWLP_ subclass cluster, OFN hook-proc returns -> UINT_PTR,
      lCustData/lResult LONG -> LONG_PTR/LRESULT pointer-truncation fixes.
    - cui optdict.cxx (93b3eead64): 0LU -> sal_uLong(0LU), resolving a
      0-vs-NULL overload ambiguity (int-type vs pointer overload) that only
      bites once sal_uLong widens on x64.
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit 25104ebbcafb3621565a09fbe219747935cb24c9)
---
 main/crashrep/source/win32/soreport.cpp            | 76 +++++++++++++---------
 main/cui/source/options/optdict.cxx                |  4 +-
 .../source/win32/filepicker/FileOpenDlg.cxx        | 22 +++----
 .../source/win32/filepicker/FileOpenDlg.hxx        | 10 +--
 .../source/win32/filepicker/WinFileOpenImpl.cxx    | 14 ++--
 .../source/win32/filepicker/WinFileOpenImpl.hxx    |  4 +-
 6 files changed, 71 insertions(+), 59 deletions(-)

diff --git a/main/crashrep/source/win32/soreport.cpp b/main/crashrep/source/win32/soreport.cpp
index d3c95500bc..3059ec481c 100644
--- a/main/crashrep/source/win32/soreport.cpp
+++ b/main/crashrep/source/win32/soreport.cpp
@@ -166,7 +166,7 @@ static FILE *_tmpfile(void)
 
 			if ( IsValidHandle( hFile ) )
 			{
-				int fd = _open_osfhandle( (int)hFile, 0 );
+				int fd = _open_osfhandle( (intptr_t)hFile, 0 );
 
 				fp = _fdopen( fd, "w+b" );
 			}
@@ -666,7 +666,7 @@ BOOL WriteReportFile( CrashReportParams *pParams )
 
 			if ( hFile )
 			{
-				int	fd = _open_osfhandle( (LONG)hFile, _O_TEXT );
+				int	fd = _open_osfhandle( (intptr_t)hFile, _O_TEXT );
 				FILE	*fp = _fdopen( fd, "w+t" );
 				CHAR	szTitle[1024] = "";
 				CHAR	szBuildId[1024] = "";
@@ -858,7 +858,7 @@ void ApplySystemFont( HWND hwndDlg )
 }
 */
 
-BOOL CALLBACK PreviewDialogProc(
+INT_PTR CALLBACK PreviewDialogProc(
 	HWND hwndDlg,
 	UINT uMsg,
 	WPARAM wParam,
@@ -892,8 +892,8 @@ BOOL CALLBACK PreviewDialogProc(
 			CrashReportParams *pParams = (CrashReportParams *)lParam;
 
 			TCHAR	szBuffer[256] = TEXT("");
-			HINSTANCE	hInstance = (HINSTANCE)GetWindowLong( hwndDlg, GWL_HINSTANCE );
-			HWND	hwndParent = (HWND)GetWindowLong( hwndDlg, GWL_HWNDPARENT );
+			HINSTANCE	hInstance = (HINSTANCE)GetWindowLongPtr( hwndDlg, GWLP_HINSTANCE );
+			HWND	hwndParent = (HWND)GetWindowLongPtr( hwndDlg, GWLP_HWNDPARENT );
 
 			GetWindowText( hwndParent, szBuffer, elementsof(szBuffer) );
 			SetWindowText( hwndDlg, szBuffer );
@@ -997,7 +997,7 @@ BOOL CALLBACK PreviewDialogProc(
 
 static void PreviewReport( HWND hwndParent, CrashReportParams *pParams )
 {
-	HINSTANCE	hInstance = (HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE );
+	HINSTANCE	hInstance = (HINSTANCE)GetWindowLongPtr(hwndParent, GWLP_HINSTANCE );
 
 	WriteReportFile( pParams );
 
@@ -1028,7 +1028,7 @@ void UpdateOptionsDialogControls( HWND hwndDlg )
 
 //***************************************************************************
 
-BOOL CALLBACK OptionsDialogProc(
+INT_PTR CALLBACK OptionsDialogProc(
 	HWND hwndDlg,
 	UINT uMsg,
 	WPARAM wParam,
@@ -1042,8 +1042,8 @@ BOOL CALLBACK OptionsDialogProc(
 	case WM_INITDIALOG:
 		{
 			TCHAR	szBuffer[1024] = TEXT("");
-			HINSTANCE	hInstance = (HINSTANCE)GetWindowLong( hwndDlg, GWL_HINSTANCE );
-			//HWND	hwndParent = (HWND)GetWindowLong( hwndDlg, GWL_HWNDPARENT );
+			HINSTANCE	hInstance = (HINSTANCE)GetWindowLongPtr( hwndDlg, GWLP_HINSTANCE );
+			//HWND	hwndParent = (HWND)GetWindowLongPtr( hwndDlg, GWLP_HWNDPARENT );
 
 			pParams = (CrashReportParams *)lParam;
 
@@ -1132,7 +1132,7 @@ BOOL CALLBACK OptionsDialogProc(
 
 static void OptionsDialog( HWND hwndParent, CrashReportParams *pParams )
 {
-	HINSTANCE	hInstance = (HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE );
+	HINSTANCE	hInstance = (HINSTANCE)GetWindowLongPtr(hwndParent, GWLP_HINSTANCE );
 
 	if ( IDOK == DialogBoxParam(
 		hInstance,
@@ -1158,7 +1158,7 @@ void UpdateReportDialogControls( HWND hwndDlg )
 
 //***************************************************************************
 
-BOOL CALLBACK ReportDialogProc(
+INT_PTR CALLBACK ReportDialogProc(
 	HWND hwndDlg,
 	UINT uMsg,
 	WPARAM wParam,
@@ -1169,8 +1169,8 @@ BOOL CALLBACK ReportDialogProc(
 	{
 	case WM_INITDIALOG:
 		{
-			CrashReportParams	*pParams = (CrashReportParams*)GetWindowLong( GetParent(hwndDlg), GWL_USERDATA );
-			HINSTANCE	hInstance = (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE );
+			CrashReportParams	*pParams = (CrashReportParams*)GetWindowLongPtr( GetParent(hwndDlg), GWLP_USERDATA );
+			HINSTANCE	hInstance = (HINSTANCE)GetWindowLongPtr(hwndDlg, GWLP_HINSTANCE );
 			TCHAR		szBuffer[FORMATBUFSIZE];
 
 			LoadAndFormatString( hInstance, IDS_REPORT_INTRO, szBuffer, elementsof(szBuffer) );
@@ -1214,8 +1214,8 @@ BOOL CALLBACK ReportDialogProc(
 	case WM_SHOWWINDOW:
 		if ( (BOOL)wParam )
 		{
-			HINSTANCE	hInstance = (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE );
-			CrashReportParams	*pParams = (CrashReportParams*)GetWindowLong( GetParent(hwndDlg), GWL_USERDATA );
+			HINSTANCE	hInstance = (HINSTANCE)GetWindowLongPtr(hwndDlg, GWLP_HINSTANCE );
+			CrashReportParams	*pParams = (CrashReportParams*)GetWindowLongPtr( GetParent(hwndDlg), GWLP_USERDATA );
 			TCHAR		szBuffer[FORMATBUFSIZE];
 
 			LoadAndFormatString( hInstance, IDS_REPORT_CAPTION, szBuffer, elementsof(szBuffer) );
@@ -1236,10 +1236,10 @@ BOOL CALLBACK ReportDialogProc(
 			Edit_SetText( GetDlgItem(hwndDlg, IDC_EDIT_DESCRIPTION), pParams->sComment.c_str() );
 
 			/*
-			SetWindowLong( GetDlgItem(GetParent(hwndDlg),IDFINISH), GWL_STYLE,
-				GetWindowLong( GetDlgItem(GetParent(hwndDlg),IDFINISH), GWL_STYLE) | BS_DEFPUSHBUTTON );
-			SetWindowLong( GetDlgItem(GetParent(hwndDlg),IDBACK), GWL_STYLE,
-				GetWindowLong( GetDlgItem(GetParent(hwndDlg),IDBACK), GWL_STYLE) &~ BS_DEFPUSHBUTTON );
+			SetWindowLongPtr( GetDlgItem(GetParent(hwndDlg),IDFINISH), GWLP_STYLE,
+				GetWindowLongPtr( GetDlgItem(GetParent(hwndDlg),IDFINISH), GWLP_STYLE) | BS_DEFPUSHBUTTON );
+			SetWindowLongPtr( GetDlgItem(GetParent(hwndDlg),IDBACK), GWLP_STYLE,
+				GetWindowLongPtr( GetDlgItem(GetParent(hwndDlg),IDBACK), GWLP_STYLE) &~ BS_DEFPUSHBUTTON );
 				*/
 			SetFocus( GetDlgItem(hwndDlg,IDC_EDIT_TITLE) );
 		}
@@ -1251,7 +1251,7 @@ BOOL CALLBACK ReportDialogProc(
 			{
 				TCHAR	szBuffer[32767];
 
-				CrashReportParams	*pParams = (CrashReportParams*)GetWindowLong( GetParent(hwndDlg), GWL_USERDATA );
+				CrashReportParams	*pParams = (CrashReportParams*)GetWindowLongPtr( GetParent(hwndDlg), GWLP_USERDATA );
 
 				pParams->fAllowContact = Button_GetCheck( GetDlgItem(hwndDlg, IDC_ALLOW_CONTACT) ) ? TRUE : FALSE;
 
@@ -1272,7 +1272,7 @@ BOOL CALLBACK ReportDialogProc(
 			return TRUE;
 		case IDC_OPTIONS:
 			{
-				CrashReportParams	*pParams = (CrashReportParams*)GetWindowLong( GetParent(hwndDlg), GWL_USERDATA );
+				CrashReportParams	*pParams = (CrashReportParams*)GetWindowLongPtr( GetParent(hwndDlg), GWLP_USERDATA );
 				OptionsDialog( GetParent(hwndDlg), pParams );
 			}
 			return TRUE;
@@ -1290,13 +1290,13 @@ BOOL CALLBACK ReportDialogProc(
 }
 //***************************************************************************
 
-BOOL CALLBACK WelcomeDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
+INT_PTR CALLBACK WelcomeDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
 {
 	switch ( uMsg )
 	{
 	case WM_INITDIALOG:
 		{
-			HINSTANCE	hInstance = (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE );
+			HINSTANCE	hInstance = (HINSTANCE)GetWindowLongPtr(hwndDlg, GWLP_HINSTANCE );
 			HWND	hwndRichEdit = GetDlgItem(hwndDlg, IDC_RICHEDIT21);
 			TCHAR	szBuffer[FORMATBUFSIZE];
 			TCHAR	szBuffer2[FORMATBUFSIZE];
@@ -1329,7 +1329,7 @@ BOOL CALLBACK WelcomeDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
 	case WM_SHOWWINDOW:
 		if ( (BOOL)wParam )
 		{
-			HINSTANCE	hInstance = (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE );
+			HINSTANCE	hInstance = (HINSTANCE)GetWindowLongPtr(hwndDlg, GWLP_HINSTANCE );
 			TCHAR		szBuffer[FORMATBUFSIZE];
 
 			LoadAndFormatString( hInstance, IDS_WELCOME_CAPTION, szBuffer, elementsof(szBuffer) );
@@ -1380,7 +1380,7 @@ BOOL CALLBACK WelcomeDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
 }
 //***************************************************************************
 
-BOOL CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
+INT_PTR CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
 {
 	static	HWND	hwndPages[2] = { NULL };
 	static	int		iActualPage = 0;
@@ -1389,10 +1389,10 @@ BOOL CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
 	{
 	case WM_INITDIALOG:
 		{
-			HINSTANCE	hInstance = (HINSTANCE)GetWindowLong(hwndDlg, GWL_HINSTANCE );
+			HINSTANCE	hInstance = (HINSTANCE)GetWindowLongPtr(hwndDlg, GWLP_HINSTANCE );
 			TCHAR		szBuffer[FORMATBUFSIZE];
 
-			SetWindowLong( hwndDlg, GWL_USERDATA, (LONG)lParam );
+			SetWindowLongPtr( hwndDlg, GWLP_USERDATA, (LONG)lParam );
 			hwndPages[0] = CreateDialog(
 				hInstance,
 				MAKEINTRESOURCE(IDD_WELCOME_PAGE),
@@ -1458,7 +1458,7 @@ BOOL CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
 		case IDFINISH:
 			{
 				TCHAR	szBuffer[32767];
-				CrashReportParams	*pParams = (CrashReportParams*)GetWindowLong( hwndDlg, GWL_USERDATA );
+				CrashReportParams	*pParams = (CrashReportParams*)GetWindowLongPtr( hwndDlg, GWLP_USERDATA );
 
 				pParams->fAllowContact = Button_GetCheck( GetDlgItem(hwndPages[1], IDC_ALLOW_CONTACT) ) ? TRUE : FALSE;
 
@@ -1725,9 +1725,21 @@ static bool WriteStackFile( FILE *fout, hash_map< string, string >& rLibraries,
 			STACKFRAME	frame;
 
 			ZeroMemory( &frame, sizeof(frame) );
+#if defined(INTEL)
 			frame.AddrPC.Offset = aContextRecord.Eip;
+#elif defined(X86_64)
+			frame.AddrPC.Offset = aContextRecord.Rip;
+#else
+#error Unsupported architecture
+#endif
 			frame.AddrPC.Mode = AddrModeFlat;
+#if defined(INTEL)
 			frame.AddrFrame.Offset = aContextRecord.Ebp;
+#elif defined(X86_64)
+			frame.AddrFrame.Offset = aContextRecord.Rbp;
+#else
+#error Unsupported architecture
+#endif
 			frame.AddrFrame.Mode = AddrModeFlat;
 
 			BOOL bSuccess;
@@ -1766,7 +1778,7 @@ static bool WriteStackFile( FILE *fout, hash_map< string, string >& rLibraries,
 					{
 						rLibraries[ GetFileName( moduleInfo.LoadedImageName ).c_str() ] = moduleInfo.LoadedImageName;
 
-						DWORD	dwRelOffset = 0;
+						DWORD64	dwRelOffset = 0;
 						BYTE	symbolBuffer[sizeof(IMAGEHLP_SYMBOL) + 256 ];
 						PIMAGEHLP_SYMBOL	pSymbol = (PIMAGEHLP_SYMBOL)symbolBuffer;
 
@@ -2600,7 +2612,7 @@ void _cdecl SendingThread( void *lpArgs )
 
 //***************************************************************************
 
-BOOL CALLBACK SendingStatusDialogProc(
+INT_PTR CALLBACK SendingStatusDialogProc(
 	HWND hwndDlg,
 	UINT uMsg,
 	WPARAM wParam,
@@ -2615,8 +2627,8 @@ BOOL CALLBACK SendingStatusDialogProc(
 	case WM_INITDIALOG:
 		{
 			TCHAR	szBuffer[1024] = TEXT("");
-			HINSTANCE	hInstance = (HINSTANCE)GetWindowLong( hwndDlg, GWL_HINSTANCE );
-			//HWND	hwndParent = (HWND)GetWindowLong( hwndDlg, GWL_HWNDPARENT );
+			HINSTANCE	hInstance = (HINSTANCE)GetWindowLongPtr( hwndDlg, GWLP_HINSTANCE );
+			//HWND	hwndParent = (HWND)GetWindowLongPtr( hwndDlg, GWLP_HWNDPARENT );
 
 			pRequest = (RequestParams *)lParam;
 
diff --git a/main/cui/source/options/optdict.cxx b/main/cui/source/options/optdict.cxx
index 9980cfdc6f..953fb3235b 100644
--- a/main/cui/source/options/optdict.cxx
+++ b/main/cui/source/options/optdict.cxx
@@ -543,8 +543,8 @@ void SvxEditDictionaryDialog::ShowWords_Impl( sal_uInt16 nId )
 
 	if (aWordsLB.GetEntryCount())
 	{
-		aWordED	  .SetText( aWordsLB.GetEntryText(0LU, 0) );
-		aReplaceED.SetText( aWordsLB.GetEntryText(0LU, 1) );
+		aWordED	  .SetText( aWordsLB.GetEntryText(sal_uLong(0LU), 0) );
+		aReplaceED.SetText( aWordsLB.GetEntryText(sal_uLong(0LU), 1) );
 	}
 
 	LeaveWait();
diff --git a/main/fpicker/source/win32/filepicker/FileOpenDlg.cxx b/main/fpicker/source/win32/filepicker/FileOpenDlg.cxx
index 5637c38f0b..7f3aaf6bc5 100644
--- a/main/fpicker/source/win32/filepicker/FileOpenDlg.cxx
+++ b/main/fpicker/source/win32/filepicker/FileOpenDlg.cxx
@@ -144,7 +144,7 @@ CFileOpenDialog::CFileOpenDialog(
 	}
 
 	// set a pointer to myself as ofn parameter
-	m_ofn.lCustData = reinterpret_cast<long>(this);
+	m_ofn.lCustData = reinterpret_cast<LPARAM>(this);
 }
 
 //------------------------------------------------------------------------
@@ -430,7 +430,7 @@ rtl::OUString SAL_CALL CFileOpenDialog::getCurrentFileName() const
 //
 //------------------------------------------------------------------------
 
-sal_uInt32 SAL_CALL CFileOpenDialog::onShareViolation(const rtl::OUString&)
+UINT_PTR SAL_CALL CFileOpenDialog::onShareViolation(const rtl::OUString&)
 {
 	return 0;
 }
@@ -439,7 +439,7 @@ sal_uInt32 SAL_CALL CFileOpenDialog::onShareViolation(const rtl::OUString&)
 //
 //------------------------------------------------------------------------
 
-sal_uInt32 SAL_CALL CFileOpenDialog::onFileOk()
+UINT_PTR SAL_CALL CFileOpenDialog::onFileOk()
 {
 	return 0;
 }
@@ -489,7 +489,7 @@ void SAL_CALL CFileOpenDialog::onTypeChanged(sal_uInt32)
 //
 //------------------------------------------------------------------------
 
-sal_uInt32 SAL_CALL CFileOpenDialog::onCtrlCommand(HWND, sal_uInt16, sal_uInt16)
+UINT_PTR SAL_CALL CFileOpenDialog::onCtrlCommand(HWND, sal_uInt16, sal_uInt16)
 {
 	return 0;
 }
@@ -498,7 +498,7 @@ sal_uInt32 SAL_CALL CFileOpenDialog::onCtrlCommand(HWND, sal_uInt16, sal_uInt16)
 //
 //------------------------------------------------------------------------
 
-sal_uInt32 SAL_CALL CFileOpenDialog::onWMNotify( HWND, LPOFNOTIFY lpOfNotify )
+UINT_PTR SAL_CALL CFileOpenDialog::onWMNotify( HWND, LPOFNOTIFY lpOfNotify )
 {
 	switch(lpOfNotify->hdr.code)
 	{
@@ -553,7 +553,7 @@ void SAL_CALL CFileOpenDialog::handleInitDialog(HWND hwndDlg, HWND hwndChild)
 //
 //------------------------------------------------------------------------
 
-unsigned int CALLBACK CFileOpenDialog::ofnHookProc(
+UINT_PTR CALLBACK CFileOpenDialog::ofnHookProc(
 	HWND hChildDlg, unsigned int uiMsg, WPARAM wParam, LPARAM lParam)
 {
     HWND hwndDlg = GetParent(hChildDlg);
@@ -570,10 +570,10 @@ unsigned int CALLBACK CFileOpenDialog::ofnHookProc(
             // subclass the base dialog for WM_NCDESTROY processing
             pImpl->m_pfnBaseDlgProc =
 		        reinterpret_cast<WNDPROC>(
-			        SetWindowLong(
+			        SetWindowLongPtr(
 			            hwndDlg,
-			            GWL_WNDPROC,
-                        reinterpret_cast<LONG>(CFileOpenDialog::BaseDlgProc)));
+			            GWLP_WNDPROC,
+                        reinterpret_cast<LONG_PTR>(CFileOpenDialog::BaseDlgProc)));
             // connect the instance handle to the window
             SetProp(hwndDlg, CURRENT_INSTANCE, pImpl);
 		    pImpl->handleInitDialog(hwndDlg, hChildDlg);
@@ -614,8 +614,8 @@ LRESULT CALLBACK CFileOpenDialog::BaseDlgProc(
 		pImpl = reinterpret_cast<CFileOpenDialog*>(
 			RemoveProp(hWnd,CURRENT_INSTANCE));
 
-		SetWindowLong(hWnd, GWL_WNDPROC,
-			reinterpret_cast<LONG>(pImpl->m_pfnBaseDlgProc));
+		SetWindowLongPtr(hWnd, GWLP_WNDPROC,
+			reinterpret_cast<LONG_PTR>(pImpl->m_pfnBaseDlgProc));
 	}
 	else
 	{
diff --git a/main/fpicker/source/win32/filepicker/FileOpenDlg.hxx b/main/fpicker/source/win32/filepicker/FileOpenDlg.hxx
index 16075788ba..2c10cc6258 100644
--- a/main/fpicker/source/win32/filepicker/FileOpenDlg.hxx
+++ b/main/fpicker/source/win32/filepicker/FileOpenDlg.hxx
@@ -244,8 +244,8 @@ protected:
 	virtual void SAL_CALL postModal(sal_Int16 nDialogResult);
 
 	// message handler, to be overwritten by subclasses
-	virtual sal_uInt32 SAL_CALL onShareViolation(const rtl::OUString& aPathName);
-	virtual sal_uInt32 SAL_CALL onFileOk();
+	virtual UINT_PTR SAL_CALL onShareViolation(const rtl::OUString& aPathName);
+	virtual UINT_PTR SAL_CALL onFileOk();
 	virtual void SAL_CALL onSelChanged(HWND hwndListBox);
 	virtual void SAL_CALL onHelp();
 
@@ -256,9 +256,9 @@ protected:
 
 	virtual void SAL_CALL onInitDialog(HWND hwndDlg) = 0;
 
-	virtual sal_uInt32 SAL_CALL onCtrlCommand(HWND hwndDlg, sal_uInt16 ctrlId, sal_uInt16 notifyCode);
+	virtual UINT_PTR SAL_CALL onCtrlCommand(HWND hwndDlg, sal_uInt16 ctrlId, sal_uInt16 notifyCode);
 
-	sal_uInt32 SAL_CALL onWMNotify(HWND hwndChild, LPOFNOTIFYW lpOfNotify);
+	UINT_PTR SAL_CALL onWMNotify(HWND hwndChild, LPOFNOTIFYW lpOfNotify);
 
 	// we use non-virtual functions to do necessary work before
 	// calling the virtual functions (see Gamma: Template method)
@@ -300,7 +300,7 @@ private:
     WNDPROC	    		m_pfnBaseDlgProc;
 
 	// callback function
-	static unsigned int CALLBACK ofnHookProc(
+	static UINT_PTR CALLBACK ofnHookProc(
 		HWND hChildDlg, // handle to child dialog box
 		unsigned int uiMsg,     // message identifier
 		WPARAM wParam,  // message parameter
diff --git a/main/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx b/main/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx
index 5d45db5614..0fa46dcb29 100644
--- a/main/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx
+++ b/main/fpicker/source/win32/filepicker/WinFileOpenImpl.cxx
@@ -508,7 +508,7 @@ inline sal_Bool SAL_CALL CWinFileOpenImpl::IsCustomControlHelpRequested(LPHELPIN
 LRESULT CALLBACK CWinFileOpenImpl::SubClassFunc(
     HWND hWnd, UINT wMessage, WPARAM wParam, LPARAM lParam)
 {
-	unsigned int lResult = 0;
+	LRESULT lResult = 0;
 
     CWinFileOpenImpl* pImpl = dynamic_cast<CWinFileOpenImpl*>(getCurrentInstance(hWnd));
 
@@ -553,8 +553,8 @@ LRESULT CALLBACK CWinFileOpenImpl::SubClassFunc(
 
     case WM_NCDESTROY:
 		// restore the old window proc
-		SetWindowLong(hWnd, GWL_WNDPROC,
-			reinterpret_cast<LONG>(pImpl->m_pfnOldDlgProc));
+		SetWindowLongPtr(hWnd, GWLP_WNDPROC,
+			reinterpret_cast<LONG_PTR>(pImpl->m_pfnOldDlgProc));
 
 		lResult = CallWindowProc(
 			reinterpret_cast<WNDPROC>(pImpl->m_pfnOldDlgProc),
@@ -654,7 +654,7 @@ BOOL CALLBACK CWinFileOpenImpl::EnumChildWndProc(HWND hWnd, LPARAM lParam)
 //
 //-----------------------------------------------------------------
 
-sal_uInt32 SAL_CALL CWinFileOpenImpl::onFileOk()
+UINT_PTR SAL_CALL CWinFileOpenImpl::onFileOk()
 {
     m_NonExecuteFilePickerState->reset();
 
@@ -832,7 +832,7 @@ void SAL_CALL CWinFileOpenImpl::onTypeChanged(sal_uInt32)
 // onMessageCommand handler
 //-----------------------------------------------------------------------------------------
 
-sal_uInt32 SAL_CALL CWinFileOpenImpl::onCtrlCommand(
+UINT_PTR SAL_CALL CWinFileOpenImpl::onCtrlCommand(
 	HWND, sal_uInt16 ctrlId, sal_uInt16)
 {
     SetDefaultExtension();
@@ -905,8 +905,8 @@ void SAL_CALL CWinFileOpenImpl::onInitDialog(HWND hwndDlg)
 	// subclass the dialog window
 	m_pfnOldDlgProc =
 		reinterpret_cast<WNDPROC>(
-			SetWindowLong( hwndDlg, GWL_WNDPROC,
-			reinterpret_cast<LONG>(SubClassFunc)));
+			SetWindowLongPtr( hwndDlg, GWLP_WNDPROC,
+			reinterpret_cast<LONG_PTR>(SubClassFunc)));
 }
 
 //-----------------------------------------------------------------------------------------
diff --git a/main/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx b/main/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx
index 0bbb481a9e..f10f0667d2 100644
--- a/main/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx
+++ b/main/fpicker/source/win32/filepicker/WinFileOpenImpl.hxx
@@ -170,7 +170,7 @@ protected:
 	virtual bool SAL_CALL preModal( );
 	virtual void SAL_CALL postModal( sal_Int16 nDialogResult );
 
-	virtual sal_uInt32 SAL_CALL onFileOk();
+	virtual UINT_PTR SAL_CALL onFileOk();
 	virtual void SAL_CALL onSelChanged( HWND hwndListBox );
 
 	// only called back if OFN_EXPLORER is set
@@ -181,7 +181,7 @@ protected:
 	// call base class method first when overloading
 	virtual void SAL_CALL onInitDialog( HWND hwndDlg );
 
-	virtual sal_uInt32 SAL_CALL onCtrlCommand( HWND hwndDlg, sal_uInt16 ctrlId, sal_uInt16 notifyCode );
+	virtual UINT_PTR SAL_CALL onCtrlCommand( HWND hwndDlg, sal_uInt16 ctrlId, sal_uInt16 notifyCode );
 
 
 	void onWMSize();


(openoffice) 07/20: sal: fix std::min type ambiguity in osl/w32 profile.cxx on x64

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 3db6ef0622880653d263d925fb5b35d8bb8c8f2f
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Tue Jul 21 12:06:27 2026 +0200

    sal: fix std::min type ambiguity in osl/w32 profile.cxx on x64
    
    getLine() computes `min(pChr - pFile->m_pReadPtr, MaxLen)` where the
    pointer difference is ptrdiff_t (64-bit on x64) while MaxLen is int.
    When `min` resolves to std::min -- which it does whenever NOMINMAX is
    defined, suppressing the <windows.h> min/max macros -- the two mismatched
    argument types make template argument deduction ambiguous:
    
      error C2782: 'const _Ty &std::min(const _Ty &,const _Ty &)' :
      template parameter '_Ty' is ambiguous  (could be 'int' or '__int64')
    
    On x86 both operands are int (ptrdiff_t == int), so it compiled; only the
    x64 pointer-width change exposes it.  Disambiguate by casting the pointer
    difference to int (the read buffer is small, so the value always fits).
    The cast is a no-op on x86 and is correct whether `min` is the
    <windows.h> macro or std::min, so it is safe for every build.
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit 0f32c8f679d1f68cd05b9bc1513c7819376bb492)
---
 main/sal/osl/w32/profile.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main/sal/osl/w32/profile.cxx b/main/sal/osl/w32/profile.cxx
index 84f0458a06..569fa6da9e 100644
--- a/main/sal/osl/w32/profile.cxx
+++ b/main/sal/osl/w32/profile.cxx
@@ -1405,7 +1405,7 @@ static sal_Bool getLine(osl_TFile* pFile, const sal_Char *pszLine, int MaxLen)
 			 (pChr < (pFile->m_ReadBuf + sizeof(pFile->m_ReadBuf) - 1));
 			 pChr++);
 
-		Max = min(pChr - pFile->m_pReadPtr, MaxLen);
+		Max = min(static_cast<int>(pChr - pFile->m_pReadPtr), MaxLen);
 		memcpy(pLine, pFile->m_pReadPtr, Max);
 		MaxLen -= Max;
 		pLine  += Max;


(openoffice) 01/20: update harness

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 3ce2cfc700a2d2b5916ada5c5d44fee8585da995
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Mon Jun 22 23:29:10 2026 +0200

    update harness
---
 CLAUDE.md     |   3 +
 STYLEGUIDE.md | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 219 insertions(+)

diff --git a/CLAUDE.md b/CLAUDE.md
index f9ecc852fe..f56f7a43cb 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -138,6 +138,9 @@ Source code is NOT being changed — only the build system.
   - BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 disables auto-detection
 
 ## Key conventions
+- BUILD-file authoring conventions (module skeleton, naming, idioms, anti-patterns):
+  see STYLEGUIDE.md.  The rules below are the operating/landmine notes; STYLEGUIDE.md
+  is the copy-paste pattern reference for new modules.
 - BUILD.bazel files live at main/<package>/BUILD.bazel (NOT prj/)
   - prj/ convention only worked for nmake() wrappers; cc_library needs
     glob() access to sources which requires the BUILD at module root
diff --git a/STYLEGUIDE.md b/STYLEGUIDE.md
new file mode 100644
index 0000000000..10196c63fc
--- /dev/null
+++ b/STYLEGUIDE.md
@@ -0,0 +1,216 @@
+# BUILD-file Styleguide — AOO Bazel Migration
+
+How to author `BUILD.bazel` and `.bzl` files so a new module looks like the
+ones already migrated. This is the **code** styleguide for this repo — the
+actual C++/Java source is out of scope (see [CLAUDE.md](CLAUDE.md) "Goal").
+
+For *operating* rules (build commands, workflow, guardrails) see
+[CLAUDE.md](CLAUDE.md). For *why* a given pattern exists, the
+`MEMORY.md` milestone for that module is the primary record. This file is
+the **generalization** of those ~50 milestones into copy-pasteable shape.
+
+Canonical reference example to imitate: [main/basctl/BUILD.bazel](main/basctl/BUILD.bazel)
+(a full first-party DLL with SDI, RSC, shielded includes, implib export).
+Foundational library example: [main/sal/BUILD.bazel](main/sal/BUILD.bazel).
+
+---
+
+## 1. Module BUILD skeleton
+
+A first-party module DLL is built in this order. Copy the shape, not the names.
+
+```python
+package(default_visibility = ["//visibility:public"])
+
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
+# load only the pipelines this module actually uses (rsc_res, sdi_target, ...)
+
+# 1. Defines and copts as module-local _DEFINES / _COPTS lists (see §2)
+_DEFINES = [ "WNT", "GUI", "WIN32", ... , "snprintf=_snprintf", "SUPD=680" ]
+_COPTS   = [ "/Zc:wchar_t-", "/Imain/<mod>/inc", "/Imain/<mod>/source/inc", ... ]
+
+# 2. Header / include "shield" libraries (see §3)
+cc_library(name = "<mod>_inc",        textual_hdrs = glob(["inc/**"]),        strip_include_prefix = "inc")
+cc_library(name = "<mod>_source_inc", textual_hdrs = glob(["source/inc/**"]), strip_include_prefix = "source/inc")
+
+# 3. Generated inputs (SDI slots, IDL, etc.) — only if the module uses them
+sdi_target(name = "<mod>slots_sdi", ...)
+cc_library(name = "<mod>slots_headers", hdrs = [":<mod>slots_sdi"], includes = ["<mod>slots_sdi_inc"])
+
+# 4. The DLL itself
+cc_binary(
+    name = "<mod>",
+    srcs = ["inc/pch/precompiled_<mod>.cxx"] + glob(["source/**/*.cxx", "source/**/*.hxx"]),
+    copts = _COPTS,
+    defines = _DEFINES,
+    linkshared = True,
+    win_def_file = "util/<mod>.def",      # see §5
+    deps = [ ":<mod>_inc", ... , "//main/sal:sal_headers", ... ],   # headers only
+    additional_linker_inputs = [ "//main/sal:sal_implib", ... ],    # implibs (see §5)
+    linkopts = [ "$(execpath //main/sal:sal_implib)", ... , "shell32.lib" ],
+)
+
+# 5. Re-export this module's own implib for downstream consumers (see §5)
+filegroup(name = "<mod>_implib", srcs = [":<mod>"], output_group = "interface_library")
+
+# 6. Resources / config, if any (see §6)
+rsc_res(name = "<mod>_res", ...)
+filegroup(name = "uiconfig_files", srcs = glob(["uiconfig/**/*.xml"]), visibility = ["//main/postprocess:__pkg__"])
+exports_files(glob(["**/*.component"]))
+```
+
+**Driving the dep graph:** parse the module's legacy `build.lst` /
+`makefile.mk` to derive `deps`. `SLOFILES`/`OBJFILES` lists tell you exactly
+which sources belong in the library — prefer matching them over a blind
+`glob`, and `exclude` the ones a glob over-collects (see `main/sal` rtl: it
+excludes `gen_makefile.cxx`, `alloc_fini.cxx`, `strtmpl.c` because they are
+not in `SLOFILES`).
+
+---
+
+## 2. Defines & copts conventions
+
+- Hoist into module-local `_DEFINES` and `_COPTS` lists at the top of the file
+  so every target in the module shares them. Don't inline per-target.
+- The cross-cutting flags (`/Zc:wchar_t-`, `snprintf=_snprintf`,
+  `stlport` dep, `Z_PREFIX`, `CURL_STATICLIB`, …) are catalogued in
+  [CLAUDE.md](CLAUDE.md) "Cross-cutting compiler flags & defines". **Check that
+  list before building any new module** — most "mysterious" link/ABI failures
+  are a missing entry from it.
+- `_HAS_ITERATOR_DEBUGGING=0` is set **globally** in the toolchain — do **not**
+  re-add it per module (redundant; see CLAUDE.md).
+- Use a `_SLO_DEFINES = _DEFINES + ["SHAREDLIB", "_DLL_"]` derived list when a
+  module builds both shared- and static-lib object sets (see `main/sal`).
+
+---
+
+## 3. Idioms to copy
+
+### Shield (`_inc`) libraries — beat header-shadowing by name
+Many modules have identically-named headers (`helpid.hrc`, `*sh.hrc`). Expose a
+module's own `inc/` and `source/inc/` as **separate** `cc_library` targets with
+`strip_include_prefix`, listed **first** in `deps`, so they resolve before any
+transitively-added same-named header. Use `textual_hdrs` (not `hdrs`) for
+`.hrc`/`.tab`/`#include`d data files so Bazel doesn't try to compile-check them.
+Reference: [main/basctl/BUILD.bazel](main/basctl/BUILD.bazel) `basctl_inc` /
+`basctl_source_inc`, and the cui/basctl milestones in `MEMORY.md`.
+
+### Per-subdir `/I` copts for flat sibling includes
+Source that includes a sibling header by bare name (`<baside2.hrc>`,
+`"precompiled_sal.hxx"`) needs that exact directory on the include path. Add a
+`/Imain/<mod>/<subdir>` copt per such subdir (basctl adds `/Imain/basctl/source/basicide`).
+
+### `_headers` libraries are the public contract
+A module exposes its API to others as `//main/<mod>:<mod>_headers` (headers +
+`strip_include_prefix` + `includes`), never by depending on its `cc_binary`.
+Downstream `deps` carry **only** `_headers`; linking is via implibs (§5).
+
+### Generated headers get a wrapper `cc_library`
+SDI/IDL/MIDL output is wrapped: `hdrs = [":<gen>"]`, `includes =
+["<gen>_inc"]` (or `includes = ["."]` / `[".."]` for generated-header dirs).
+Reference: `basslots_headers`, and the winaccessibility/writerfilter milestones.
+
+### `textual_hdrs` for included data tables
+`.tab` files (`main/sal` textenc), `hash.cxx` (sdext pdfimport), private
+`types.idl`-derived headers — anything `#include`d rather than compiled — goes
+in `textual_hdrs`.
+
+---
+
+## 4. Naming conventions
+
+| Target | Pattern | Example |
+|---|---|---|
+| Public header lib | `<mod>_headers` | `sal_headers`, `tools_headers` |
+| Private include shield | `<mod>_inc`, `<mod>_source_inc` | `basctl_inc` |
+| Resource-constant shield | `<mod>_source_hrc`, `<mod>_hrc` | `basctl_source_hrc`, `svl_hrc` |
+| The DLL | `<mod>` (bare) | `basctl`, `sal` |
+| Re-exported implib | `<mod>_implib` (or `<linkname>_implib`) | `basctl_implib`, `comphelpMSC_implib` |
+| SDI slot gen | `<name>slots_sdi` + `<name>slots_headers` | `basslots_sdi` |
+| RSC resource | `<mod>_res` | `basctl_res` |
+| DEF file | `util/<linkname>.def` | `util/basctl.def` |
+
+The **implib name often differs from the module name** because it matches the
+upstream link-name, not the directory (`comphelpMSC_implib`, `tl_implib`,
+`utl_implib`, `svxcore_implib`). When in doubt, check the consumer's
+`additional_linker_inputs` list.
+
+---
+
+## 5. The DLL link triad (DEF + implib in + implib out)
+
+A first-party DLL has three linking concerns that must stay consistent:
+
+1. **Exports** — convert the upstream `<name>.map` GNU-ld script to a Windows
+   `util/<name>.def` and set `win_def_file`. UNO component DLLs export exactly
+   `component_getImplementationEnvironment`, `component_getFactory`,
+   `component_canUnload`. If there is no `.map`, hand-write a minimal `.def`
+   (see starmath milestone: `sm.def`/`smd.def`, no `canUnload`).
+2. **Consuming others' implibs** — list each dependency's implib in **both**
+   `additional_linker_inputs` (so Bazel stages the file) **and** `linkopts` as
+   `$(execpath //main/<dep>:<dep>_implib)`. Both are required; the
+   `additional_linker_inputs` entry alone won't put it on the link line.
+   Plain system libs (`shell32.lib`, `user32.lib`, `ws2_32.lib`) go straight
+   in `linkopts`.
+3. **Exposing your own implib** — end the file with
+   `filegroup(name="<mod>_implib", srcs=[":<mod>"], output_group="interface_library")`
+   so downstream modules can link you.
+
+---
+
+## 6. Resources, config, components
+
+- **RSC** (`rsc_res`): `srcs` = `.src`, `hdrs` = `.hrc` (own + cross-module
+  `*_inc_hrc` filegroups), `includes` = every `.hrc` search dir, and
+  **`images_root = "main/default_images"`** — this exact value is mandatory for
+  any module with `Bitmap { File = "x.png" }` (see CLAUDE.md; a module-specific
+  `images_root` silently empties every `BitmapEx(ResId)`).
+- **uiconfig**: expose as a `filegroup` visible to `//main/postprocess` only;
+  it is staged as a **folder tree**, never a zip.
+- **`.component`** files: `exports_files(glob(["**/*.component"]))` so the
+  postprocess/services.rdb pipeline can read them.
+
+---
+
+## 7. `.bzl` custom rules
+
+When a build step has no `cc_*`/`genrule` fit, it gets a Starlark rule under
+`build/rules/<thing>.bzl` (existing: `idl_pipeline`, `rsc_pipeline`,
+`sdi_target`, `images`, `scp2`, `localedata_pipeline`, `gtest_test`, …).
+Conventions, by example:
+
+- Prefer `ctx.actions.run` with explicit tool inputs over `run_shell`; use
+  `ctx.actions.symlink` (pure Bazel) for staging, not a shell `cp`.
+- Tools that link `/MD` need their CRT DLLs + **external** `.manifest` staged
+  beside the EXE (the `svidl_bundle` pattern — replicated in `gtest_test.bzl`;
+  miss it and you get R6034). See the test-infra and IDL milestones.
+- A rule that emits headers must advertise the include dir via an `includes`
+  provider/attr so the wrapper `cc_library` can surface it.
+- Keep the rule's migration rationale in its module `readme.md` and a one-line
+  `MEMORY.md` pointer — that is where future-you will look.
+
+---
+
+## 8. Anti-patterns (do NOT do)
+
+- ❌ Put a BUILD file in `prj/`. First-party modules need `glob()` over sources
+  → BUILD lives at `main/<mod>/BUILD.bazel`.
+- ❌ Depend on another module's `cc_binary` to get its headers. Use `_headers`.
+- ❌ Module-specific `images_root`. Always `"main/default_images"`.
+- ❌ Re-add `_HAS_ITERATOR_DEBUGGING=0` per module (global already).
+- ❌ Put an implib only in `additional_linker_inputs` (also needs `linkopts`).
+- ❌ Stage uiconfig as a zip (must be a folder tree).
+- ❌ Manipulate the Bazel cache directly. Use
+  `bazel mod deps --lockfile_mode=refresh` or ask the user.
+- ❌ Modify C++/Java source to make a build pass. Source is out of scope; fix
+  the build description instead. (If a source bug is genuinely blocking, raise
+  it — see the latent-UAF precedent — don't silently patch.)
+
+---
+
+## 9. After a module builds
+
+Per [CLAUDE.md](CLAUDE.md) workflow: **let the user build** (don't run the build
+yourself), add a `readme.md` migration summary to the module, add a one-line
+`MEMORY.md` milestone pointer, and **only then** update the frontier in
+CLAUDE.md. The `MEMORY.md` entry is what makes the next similar module fast.


(openoffice) 04/20: switch to LLVM Linker if we build debug builds with pbd files

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit da6d97753b9dbacd92e5039544392af0fdea15d6
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Thu Jul 2 21:41:20 2026 +0200

    switch to LLVM Linker if we build debug builds with pbd files
---
 build/toolchain/BUILD.bazel                     | 16 +++--
 build/toolchain/windows_cc_toolchain_config.bzl | 34 ++++++++--
 build/vs_config_repo.bzl                        | 88 +++++++++++++++++++++++--
 3 files changed, 123 insertions(+), 15 deletions(-)

diff --git a/build/toolchain/BUILD.bazel b/build/toolchain/BUILD.bazel
index ab0b8b16cf..5a244540d0 100644
--- a/build/toolchain/BUILD.bazel
+++ b/build/toolchain/BUILD.bazel
@@ -1,6 +1,6 @@
 load("@rules_cc//cc/toolchains:cc_toolchain.bzl", "cc_toolchain")
 load(":windows_cc_toolchain_config.bzl", "cc_toolchain_config")
-load("@vs_config//:paths.bzl", _VS = "VS", _VC = "VC", _SDK = "SDK", _MSVC_TMP = "MSVC_TMP", _LINK_WRAPPER = "LINK_WRAPPER")
+load("@vs_config//:paths.bzl", _VS = "VS", _VC = "VC", _SDK = "SDK", _MSVC_TMP = "MSVC_TMP", _LINK_WRAPPER = "LINK_WRAPPER", _PDB_LINK = "PDB_LINK")
 
 # VS2008 x86 toolchain for Apache OpenOffice on Windows
 # Paths are configured via --repo_env=VS_PATH / --repo_env=SDK_PATH in user.bazelrc.
@@ -37,10 +37,16 @@ cc_toolchain_config(
     tool_bin_path  = _VC + "\\bin",
     msvc_cl_path   = _VC + "\\bin\\cl.exe",
     msvc_ml_path   = _VC + "\\bin\\ml.exe",
-    # Native cc_library/cc_binary links go through the mspdbsrv-endpoint wrapper
-    # (see vs_config_repo.bzl) so debug (/DEBUG) builds run parallel without
-    # LNK1318.  rules_foreign_cc still uses raw link.exe via the "ld" tool_path
-    # below (external libs build without /DEBUG, so no mspdbsrv contention).
+    # Link tool selection (see windows_cc_toolchain_config.bzl link_tools):
+    #  - generate_pdb builds (debug .pdb) link with a modern MSVC link.exe
+    #    (auto-discovered under VS_MODERN_PATH), whose mspdbsrv writes PDBs in
+    #    parallel — so /DEBUG links run at full --jobs without the VC9 LNK1318
+    #    mspdbsrv contention. It reads the VC9 /Z7 objects natively.
+    #  - all other links use VC9 link.exe (via the mspdbsrv-endpoint wrapper),
+    #    so shipped non-PDB binaries are produced by the same linker as before.
+    # rules_foreign_cc still uses raw link.exe via the "ld" tool_path below
+    # (external libs build without /DEBUG, so no mspdbsrv contention there).
+    pdb_link_path  = _PDB_LINK,
     msvc_link_path = _LINK_WRAPPER,
     msvc_lib_path  = _VC + "\\bin\\lib.exe",
     cxx_builtin_include_directories = [
diff --git a/build/toolchain/windows_cc_toolchain_config.bzl b/build/toolchain/windows_cc_toolchain_config.bzl
index 0a26698240..85924bb390 100644
--- a/build/toolchain/windows_cc_toolchain_config.bzl
+++ b/build/toolchain/windows_cc_toolchain_config.bzl
@@ -146,6 +146,24 @@ def _impl(ctx):
         ]
 
     if _use_msvc_toolchain(ctx):
+        # Linker tool selection for the executable / dynamic-library link actions.
+        # When the generate_pdb feature is enabled (debug builds that emit .pdb),
+        # Bazel runs a modern MSVC link.exe (pdb_link_path, auto-discovered from a
+        # VS2017+/BuildTools install). The VC9 linker's single mspdbsrv cannot
+        # write PDBs in parallel (LNK1318 0x6BA; VC9 has no /FS), while a modern
+        # link.exe reads the VC9 /Z7 objects natively and its mspdbsrv handles
+        # parallel PDB writes — so debug builds run at full --jobs. (LLVM lld-link
+        # was rejected: it cannot emit PDBs from VC9-era CodeView.) Every other
+        # link stays on VC9 link.exe so shipped (non-PDB) binaries are produced by
+        # the same linker as before. Bazel selects the first tool whose
+        # with_features set matches the active feature configuration.
+        link_tools = [
+            tool(
+                path = ctx.attr.pdb_link_path,
+                with_features = [with_feature_set(features = ["generate_pdb"])],
+            ),
+            tool(path = ctx.attr.msvc_link_path),
+        ]
         cpp_link_nodeps_dynamic_library_action = action_config(
             action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library,
             implies = [
@@ -162,7 +180,7 @@ def _impl(ctx):
                 "has_configured_linker_path",
                 "def_file",
             ],
-            tools = [tool(path = ctx.attr.msvc_link_path)],
+            tools = link_tools,
         )
 
         cpp_link_static_library_action = action_config(
@@ -256,7 +274,7 @@ def _impl(ctx):
                 "msvc_env",
                 "no_stripping",
             ],
-            tools = [tool(path = ctx.attr.msvc_link_path)],
+            tools = link_tools,
         )
 
         cpp_link_dynamic_library_action = action_config(
@@ -275,7 +293,7 @@ def _impl(ctx):
                 "has_configured_linker_path",
                 "def_file",
             ],
-            tools = [tool(path = ctx.attr.msvc_link_path)],
+            tools = link_tools,
         )
 
         deps_scanner = "cpp-module-deps-scanner_not_found"
@@ -1366,7 +1384,14 @@ def _impl(ctx):
             flag_sets = [
                 flag_set(
                     actions = all_link_actions,
-                    flag_groups = [flag_group(flags = ["/DEBUG"])],
+                    # /DEBUG: emit the separate .pdb.
+                    # /SAFESEH:NO: this feature routes links through lld-link (see
+                    # link_tools), which — unlike VC9 link.exe — enforces /safeseh
+                    # on x86 and rejects data-only objects that carry no SEH table
+                    # (e.g. ICU's icudt49_dat.obj). SafeSEH is a ship-time mitigation
+                    # and these are non-distributed debug binaries, so disabling it
+                    # here is harmless and only affects the generate_pdb path.
+                    flag_groups = [flag_group(flags = ["/DEBUG", "/SAFESEH:NO"])],
                 ),
             ],
         )
@@ -1825,6 +1850,7 @@ This is only offered as a migration bridge for projects transitioning to rule-ba
         "msvc_lib_path": attr.string(default = "vc_installation_error.bat"),
         "msvc_link_path": attr.string(default = "vc_installation_error.bat"),
         "msvc_ml_path": attr.string(default = "vc_installation_error.bat"),
+        "pdb_link_path": attr.string(default = "vc_installation_error.bat"),
         "shorten_virtual_includes": attr.bool(default = False),
         "supports_parse_showincludes": attr.bool(),
         "target_libc": attr.string(),
diff --git a/build/vs_config_repo.bzl b/build/vs_config_repo.bzl
index e1f283af06..df0fb7dbc8 100644
--- a/build/vs_config_repo.bzl
+++ b/build/vs_config_repo.bzl
@@ -7,9 +7,19 @@ flag value so bazelrc doesn't strip backslashes):
   build --repo_env="SDK_PATH=C:/Program Files/Microsoft SDKs/Windows/v7.0"
   build --repo_env="MSVC_TMP=C:/Users/<you>/AppData/Local/Temp"
   build --repo_env="PERL_PATH=C:/msys64/usr/bin/perl.exe"
+  build --repo_env="VS_MODERN_PATH=C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools"
 
 The generated @vs_config//:paths.bzl exposes VS, VC, SDK, MSVC_TMP,
-PERL, DEBUG_CRT_DIR, and LINK_WRAPPER.
+PERL, DEBUG_CRT_DIR, LINK_WRAPPER, and PDB_LINK.
+
+PDB_LINK is a modern MSVC link.exe (auto-discovered under VS_MODERN_PATH).
+The C++ toolchain routes generate_pdb (debug .pdb) links to it instead of
+VC9 link.exe: the VC9 linker's single mspdbsrv cannot write PDBs in parallel
+(LNK1318 0x6BA, no /FS), while a modern link.exe reads the VC9 /Z7 objects
+natively and its mspdbsrv handles parallel PDB writes — so debug builds run
+at full --jobs.  (LLVM lld-link was evaluated and rejected: it cannot write
+PDBs from VC9-era CodeView — "Stream too short".)  Non-PDB links stay on VC9
+link.exe via LINK_WRAPPER, below, so shipped binaries are unchanged.
 
 LINK_WRAPPER is a generated batch file that wraps link.exe and gives every
 link action its own _MSPDBSRV_ENDPOINT_ (derived from the unique per-target
@@ -19,28 +29,70 @@ LNK1318 RPC_S_SERVER_UNAVAILABLE (0x6BA), which is the only reason debug builds
 ever needed --jobs=1.  Routing all links through the wrapper lets debug builds
 run fully parallel.  VS2008/VC9 has no /FS flag (added in VS2013), so the
 per-process endpoint is the only fix available here.
+
+Endpoint isolation prevents shared-server *corruption*, but each isolated link
+must still spawn its own mspdbsrv.exe, and a wide parallel link phase can still
+transiently lose the RPC handshake (LNK1318 0x6BA) when many servers start at
+once.  So the wrapper also retries link.exe on LNK1318 with a linear backoff,
+handing each attempt a *fresh* endpoint (…_a1, _a2, …) so a retry never
+reconnects to a half-dead server from the previous try.  Non-PDB link errors
+(unresolved externals, etc.) are detected and returned immediately without
+wasting retries.  Tunable via LINK_MAX_RETRY / LINK_RETRY_BASE_SEC env vars.
 """
 
 _DEFAULT_VS   = "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0"
 _DEFAULT_SDK  = "C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0"
 _DEFAULT_TMP  = "C:\\Temp"
 _DEFAULT_PERL = "C:\\msys64\\usr\\bin\\perl.exe"
+# Modern MSVC (VS2017+/BuildTools) install root — only used to source a newer
+# link.exe for the generate_pdb path (see _find_modern_link / PDB_LINK below).
+_DEFAULT_VS_MODERN = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools"
+
+def _find_modern_link(rctx, vs_modern):
+    """Locate the newest VS2017+ x86-target link.exe under a BuildTools/VS root.
+
+    The VC9 link.exe cannot write PDBs in parallel (single mspdbsrv, no /FS, the
+    LNK1318 bug); LLVM lld-link cannot write PDBs from VC9-era CodeView at all
+    ("Stream too short"). A modern MSVC link.exe reads the VC9 /Z7 objects natively
+    and its mspdbsrv handles parallel PDB writes, so the generate_pdb link path
+    uses it. Returns a placeholder if none is found (only breaks generate_pdb builds).
+    """
+    tools = rctx.path(vs_modern + "\\VC\\Tools\\MSVC")
+    if not tools.exists:
+        return "modern_link_not_found.bat"
+    best = None
+    for ver in tools.readdir():
+        for host in ["Hostx64", "Hostx86"]:
+            link = ver.get_child("bin").get_child(host).get_child("x86").get_child("link.exe")
+            if link.exists:
+                if best == None or ver.basename > best[0]:
+                    best = (ver.basename, str(link))
+                break
+    if best == None:
+        return "modern_link_not_found.bat"
+    return best[1]
 
 def _vs_config_impl(rctx):
     vs   = rctx.os.environ.get("VS_PATH",   _DEFAULT_VS)
     sdk  = rctx.os.environ.get("SDK_PATH",  _DEFAULT_SDK)
     tmp  = rctx.os.environ.get("MSVC_TMP",  _DEFAULT_TMP)
     perl = rctx.os.environ.get("PERL_PATH", _DEFAULT_PERL)
+    vs_modern = rctx.os.environ.get("VS_MODERN_PATH", _DEFAULT_VS_MODERN)
     vc   = vs + "\\VC"
+    pdb_link = _find_modern_link(rctx, vs_modern)
     debug_crt = vc + "\\redist\\Debug_NonRedist\\x86\\Microsoft.VC90.DebugCRT"
 
     def q(p):
         return p.replace("\\", "\\\\")
 
     # link.exe wrapper: per-action _MSPDBSRV_ENDPOINT_ so concurrent /DEBUG links
-    # each get a private mspdbsrv.exe instead of sharing one (LNK1318 0x6BA).
+    # each get a private mspdbsrv.exe instead of sharing one (LNK1318 0x6BA), plus
+    # a bounded retry-with-backoff on LNK1318 (fresh endpoint per attempt) for the
+    # residual "server unavailable" that isolation alone can't prevent.
     # The endpoint is derived from the linker @param-file name (unique per target,
     # always on the command line); falls back to %RANDOM% if no @file is present.
+    # Output is captured so we can tell a transient PDB failure (retry) from a real
+    # link error (return immediately).  Dynamic wait grows linearly per attempt.
     link_exe = vc + "\\bin\\link.exe"
     bat = "\r\n".join([
         "@echo off",
@@ -56,9 +108,32 @@ def _vs_config_impl(rctx):
         "set \"ep=!ep:/=_!\"",
         "set \"ep=!ep:.=_!\"",
         "set \"ep=!ep::=_!\"",
-        "set \"_MSPDBSRV_ENDPOINT_=bzl_!ep!\"",
-        "\"" + link_exe + "\" %*",
-        "exit /b !ERRORLEVEL!",
+        # Tunables (override via --action_env at build time), with sane defaults.
+        "if not defined LINK_MAX_RETRY set \"LINK_MAX_RETRY=5\"",
+        "if not defined LINK_RETRY_BASE_SEC set \"LINK_RETRY_BASE_SEC=2\"",
+        "set \"log=%TEMP%\\bzl_link_%RANDOM%%RANDOM%.log\"",
+        "set \"n=0\"",
+        ":retry",
+        "set /a n+=1",
+        # Fresh endpoint each attempt so a retry spawns a brand-new mspdbsrv.exe
+        # instead of reconnecting to a hung/half-dead one from the previous try.
+        "set \"_MSPDBSRV_ENDPOINT_=bzl_!ep!_a!n!\"",
+        "\"" + link_exe + "\" %* > \"!log!\" 2>&1",
+        "set \"rc=!ERRORLEVEL!\"",
+        "if !rc! equ 0 goto done",
+        # Only LNK1318 (PDB RPC) is transient; anything else is a real failure.
+        "findstr /c:\"LNK1318\" \"!log!\" >nul",
+        "if errorlevel 1 goto done",
+        "if !n! geq !LINK_MAX_RETRY! goto done",
+        "set /a wait=!n!*!LINK_RETRY_BASE_SEC!",
+        "set /a pings=!wait!+1",
+        "echo [msvc_link] LNK1318 PDB RPC error; retry !n!/!LINK_MAX_RETRY! after !wait!s (endpoint bzl_!ep!_a!n!)>&2",
+        "ping -n !pings! 127.0.0.1 >nul",
+        "goto retry",
+        ":done",
+        "type \"!log!\"",
+        "del \"!log!\" >nul 2>&1",
+        "exit /b !rc!",
         "",
     ])
     rctx.file("msvc_link.bat", bat)
@@ -74,6 +149,7 @@ def _vs_config_impl(rctx):
         'PERL     = "{}"'.format(q(perl)),
         'DEBUG_CRT_DIR = "{}"'.format(q(debug_crt)),
         'LINK_WRAPPER = "{}"'.format(q(link_wrapper)),
+        'PDB_LINK = "{}"'.format(q(pdb_link)),
         "",
     ])
     rctx.file("paths.bzl", content)
@@ -81,5 +157,5 @@ def _vs_config_impl(rctx):
 
 vs_config_repo = repository_rule(
     implementation = _vs_config_impl,
-    environ = ["VS_PATH", "SDK_PATH", "MSVC_TMP", "PERL_PATH"],
+    environ = ["VS_PATH", "SDK_PATH", "MSVC_TMP", "PERL_PATH", "VS_MODERN_PATH"],
 )


(openoffice) 17/20: build/win64: name the target platforms winXP-x86/winXP-x64 + win_version constraint

Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 6759c81b933b3e4bc19afbf66f0ff0e9122f52f4
Author: Peter Kovacs <pe...@apache.org>
AuthorDate: Sat Jul 25 10:47:13 2026 +0200

    build/win64: name the target platforms winXP-x86/winXP-x64 + win_version constraint
    
    Rename //build/platforms:windows_x86/x64 -> winXP-x86/winXP-x64 to record the
    intent (VC9/VS2008 + SDK v7.0 is the XP-era toolchain we stay on).  Add a
    //build/constraints:win_version constraint_setting (winxp/win10 values +
    is_winxp/is_win10 config_settings) composed ORTHOGONALLY with @platforms//cpu:*
    in the platforms.  This is the Bazel-native way to model the target Windows
    floor: a future win10-x64 becomes a new constraint point that select() can
    branch on to drive deps/defines, not a stringly-typed --config.
    
    .bazelrc keeps only the thin --config=winXP-x86/x64 -> --platforms alias plus
    the per-arch --platform_suffix / --symlink_prefix (output trees
    bazel-winXP-x86-/bazel-winXP-x64-).  register_execution_platforms + toolchain
    comments updated to the new labels.
    
    Co-Authored-By: Claude Opus 4.8 <no...@anthropic.com>
    (cherry picked from commit 6e86c614c63b2ea60c3e4bf087f8a387f3dddb6a)
---
 .bazelrc                      | 24 +++++++++++--------
 MODULE.bazel                  | 12 +++++-----
 build/constraints/BUILD.bazel | 54 +++++++++++++++++++++++++++++++++++++++++++
 build/platforms/BUILD.bazel   | 28 +++++++++++++++++-----
 build/toolchain/BUILD.bazel   |  4 ++--
 5 files changed, 98 insertions(+), 24 deletions(-)

diff --git a/.bazelrc b/.bazelrc
index 6c308e625c..776d516956 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -15,15 +15,19 @@ common --registry=https://bcr.bazel.build
 # pinned explicitly (the auto host platform is x86_64 and would not resolve it).
 # Each arch pins --platforms + a distinct --platform_suffix (separate bazel-out
 # trees, no clobber) + --symlink_prefix (both convenience symlinks coexist).
-# --config=x64 overrides these x86 defaults (all three are last-value-wins).
-build --platforms=//build/platforms:windows_x86
-build --platform_suffix=x86
-build --symlink_prefix=bazel-x86-
+# Thin alias only: --config=winXP-x64 => target the winXP-x64 platform, into its
+# own output tree.  The SEMANTICS (target Windows floor, and any deps/defines that
+# vary by it) live in the //build/constraints:win_version constraint carried by the
+# platform, NOT here.  --config=winXP-x64 overrides the winXP-x86 default (all
+# last-value-wins).
+build --platforms=//build/platforms:winXP-x86
+build --platform_suffix=winXP-x86
+build --symlink_prefix=bazel-winXP-x86-
 
-build:x86 --platforms=//build/platforms:windows_x86
-build:x86 --platform_suffix=x86
-build:x86 --symlink_prefix=bazel-x86-
+build:winXP-x86 --platforms=//build/platforms:winXP-x86
+build:winXP-x86 --platform_suffix=winXP-x86
+build:winXP-x86 --symlink_prefix=bazel-winXP-x86-
 
-build:x64 --platforms=//build/platforms:windows_x64
-build:x64 --platform_suffix=x64
-build:x64 --symlink_prefix=bazel-x64-
\ No newline at end of file
+build:winXP-x64 --platforms=//build/platforms:winXP-x64
+build:winXP-x64 --platform_suffix=winXP-x64
+build:winXP-x64 --symlink_prefix=bazel-winXP-x64-
\ No newline at end of file
diff --git a/MODULE.bazel b/MODULE.bazel
index 68d76092fa..c0619fbf17 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -72,21 +72,21 @@ register_toolchains("//build/toolchain:cc_toolchain_x64_vs2008_def")
 
 # Execution platforms.  ORDER MATTERS — register_execution_platforms prepends, so the
 # FIRST entry is the highest-priority exec platform.
-#   windows_x64 (x86_64) MUST be first: it becomes the exec platform for all build
+#   winXP-x64 (x86_64) MUST be first: it becomes the exec platform for all build
 #     actions and cfg="exec" tools (idlc/regmerge/cppumaker/rsc/…), so those tools are
 #     built x64 and run natively on this x64 host (matching the amd64 CRT staging).
 #     A target that requires no cc toolchain (e.g. idl_library, which just runs the
-#     staged tools) picks the first exec platform outright — if windows_x86 were first,
+#     staged tools) picks the first exec platform outright — if winXP-x86 were first,
 #     those tools would be built x86_32 (breaking the x64 regmerge/idlc link + CRT).
-#   windows_x86 (x86_32) is the fallback: this x64 host also runs 32-bit binaries via
+#   winXP-x86 (x86_32) is the fallback: this x64 host also runs 32-bit binaries via
 #     WOW64, so x86 TEST targets (target cpu:x86_32) resolve their test toolchain here
 #     (Bazel runs tests on an exec platform matching the target's constraints; without
 #     this, x86 `bazel test` fails "no matching default_test_toolchain_type").  Only the
 #     test-run action lands here — cc/exec-tool actions need a cc toolchain, which is
-#     exec_compatible_with x86_64 only, so they never select windows_x86.
+#     exec_compatible_with x86_64 only, so they never select winXP-x86.
 register_execution_platforms(
-    "//build/platforms:windows_x64",
-    "//build/platforms:windows_x86",
+    "//build/platforms:winXP-x64",
+    "//build/platforms:winXP-x86",
 )
 # Use preinstalled pkg-config instead of building it from source (building it
 # from source requires gettext_runtime whose BUILD uses a removed cc_import builtin).
diff --git a/build/constraints/BUILD.bazel b/build/constraints/BUILD.bazel
new file mode 100644
index 0000000000..b6aa22279a
--- /dev/null
+++ b/build/constraints/BUILD.bazel
@@ -0,0 +1,54 @@
+# Windows target-version constraint dimension.
+#
+# This is the Bazel-native way to model "which Windows do we target" — the same
+# mechanism @platforms//os and @platforms//cpu use.  It composes ORTHOGONALLY
+# with @platforms//cpu:{x86_32,x86_64} inside the target platforms, so the target
+# space is {winxp, win10, ...} x {x86, x64}, not a flat list of stringly-typed
+# --config names.
+#
+# Why a constraint and not just a platform name: a constraint_value can be the
+# subject of select() (via the config_settings below).  So the target Windows
+# floor can DRIVE DEPENDENCIES AND DEFINES, e.g.
+#
+#     _WIN32_WINNT = select({
+#         "//build/constraints:is_winxp": ["_WIN32_WINNT=0x0501"],
+#         "//build/constraints:is_win10": ["_WIN32_WINNT=0x0A00"],
+#     })
+#     deps = select({
+#         "//build/constraints:is_win10": ["@some_lib//:win10_variant"],
+#         "//conditions:default":         ["@some_lib//:legacy_variant"],
+#     })
+#
+# Adding win10 later is then a new constraint_value + platforms + config_setting
+# here — every consumer's select() picks it up; nothing else is stringly-coupled.
+
+package(default_visibility = ["//visibility:public"])
+
+# The dimension itself.  No default_constraint_value: platforms state their floor
+# explicitly, and the auto-detected host (exec) platform simply leaves it unset
+# (exec-config tool builds don't care about the target Windows floor).
+constraint_setting(name = "win_version")
+
+# Current: XP-era (VC9 / VS2008 + SDK v7.0 — the toolchain we stay on for XP
+# compatibility).  Future values slot in beside this one.
+constraint_value(
+    name = "winxp",
+    constraint_setting = ":win_version",
+)
+
+# Placeholder for the planned win10 target (not yet wired to a platform/toolchain).
+constraint_value(
+    name = "win10",
+    constraint_setting = ":win_version",
+)
+
+# select()-able views of the constraint.
+config_setting(
+    name = "is_winxp",
+    constraint_values = [":winxp"],
+)
+
+config_setting(
+    name = "is_win10",
+    constraint_values = [":win10"],
+)
diff --git a/build/platforms/BUILD.bazel b/build/platforms/BUILD.bazel
index 1d9a9b88ae..34311eaf83 100644
--- a/build/platforms/BUILD.bazel
+++ b/build/platforms/BUILD.bazel
@@ -1,26 +1,42 @@
 # Target platforms for the dual-arch Windows build.
-# Selected via --platforms (wired to --config=x86 / --config=x64 in .bazelrc);
-# the target cpu constraint picks which //build/toolchain cc_toolchain resolves.
+# Selected via --platforms (wired to --config=winXP-x86 / --config=winXP-x64 in
+# .bazelrc); the target cpu constraint picks which //build/toolchain cc_toolchain
+# resolves.  The "winXP" name records the intent — VC9 (VS2008) + SDK v7.0 is the
+# XP-era toolchain we stay on for XP compatibility — it is a label only and does
+# NOT set _WIN32_WINNT (currently 0x0500 on x86 / 0x0600 on the x64 bridge).
 #
-#   windows_x86 → @platforms//cpu:x86_32 → cc_toolchain_x86_vs2008 (default build)
-#   windows_x64 → @platforms//cpu:x86_64 → cc_toolchain_x64_vs2008 (Win64 build)
+#   winXP-x86 → @platforms//cpu:x86_32 → cc_toolchain_x86_vs2008 (default build)
+#   winXP-x64 → @platforms//cpu:x86_64 → cc_toolchain_x64_vs2008 (Win64 build)
 #
 # The exec (host) platform stays Bazel's auto-detected x64 Windows host for both.
 
 platform(
-    name = "windows_x86",
+    name = "winXP-x86",
     constraint_values = [
         "@platforms//os:windows",
         "@platforms//cpu:x86_32",
+        "//build/constraints:winxp",
     ],
     visibility = ["//visibility:public"],
 )
 
 platform(
-    name = "windows_x64",
+    name = "winXP-x64",
     constraint_values = [
         "@platforms//os:windows",
         "@platforms//cpu:x86_64",
+        "//build/constraints:winxp",
     ],
     visibility = ["//visibility:public"],
 )
+
+# Future (planned, not yet wired to a toolchain):
+# platform(
+#     name = "win10-x64",
+#     constraint_values = [
+#         "@platforms//os:windows",
+#         "@platforms//cpu:x86_64",
+#         "//build/constraints:win10",
+#     ],
+#     visibility = ["//visibility:public"],
+# )
diff --git a/build/toolchain/BUILD.bazel b/build/toolchain/BUILD.bazel
index 19fc963dd0..54ce2ce8ad 100644
--- a/build/toolchain/BUILD.bazel
+++ b/build/toolchain/BUILD.bazel
@@ -120,7 +120,7 @@ toolchain(
     target_compatible_with = [
         # FIX: the x86 toolchain builds 32-bit binaries, so its TARGET cpu is
         # x86_32 — not x86_64 as it wrongly declared before.  Resolved against
-        # //build/platforms:windows_x86 (--config=x86, the default).
+        # //build/platforms:winXP-x86 (--config=winXP-x86, the default).
         "@platforms//cpu:x86_32",
         "@platforms//os:windows",
     ],
@@ -240,7 +240,7 @@ toolchain(
         "@platforms//os:windows",
     ],
     target_compatible_with = [
-        # Target = Win64.  Resolved against //build/platforms:windows_x64 (--config=x64).
+        # Target = Win64.  Resolved against //build/platforms:winXP-x64 (--config=winXP-x64).
         "@platforms//cpu:x86_64",
         "@platforms//os:windows",
     ],