[PATCH] Fix msvc_gendef.pl for aarch64 (Windows on Arm)

Started by kenji uno10 months ago2 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

never appliedCI history
Jump to latest
#1kenji uno
h8mastre@gmail.com

I'm going to build psqlODBC (Arm64X binaries) for use with Windows 11 on
Arm.

The problem is that the `msvc_gendef.pl` generates the wrong `postgres.def`
for aarch64 (Windows).

Currently, for aarch64, the preceding underscore is removed like for x86.
However, the expected functionality for aarch64 is the same as for x64:
keep the preceding underscore.

This causes linker errors such as:

postgres.def : error LNK2001: unresolved external symbol

brin_parallel_build_main
[C:\repos\postgresql-17.0\build-last-try-3\src\backend\22e3565@
@postgres@exe.vcxproj]

Example from src/backend/access/brin/brin.c:

/*
* Perform work within a launched parallel process.
*/
void
_brin_parallel_build_main(dsm_segment *seg, shm_toc *toc)
{
// ...
}

The attached file is a patch to fix this issue.

--
kenji uno (h8mastre@gmail.com)

Attachments:

msvc_gendef.patchtext/plain; charset=US-ASCII; name=msvc_gendef.patchDownload+3-3
#2Peter Eisentraut
peter_e@gmx.net
In reply to: kenji uno (#1)
Re: [PATCH] Fix msvc_gendef.pl for aarch64 (Windows on Arm)

On 11.11.25 06:11, kenji uno wrote:

I'm going to build psqlODBC (Arm64X binaries) for use with Windows 11 on
Arm.

The problem is that the `msvc_gendef.pl <http://msvc_gendef.pl&gt;`
generates the wrong `postgres.def` for aarch64 (Windows).

Currently, for aarch64, the preceding underscore is removed like for x86.
However, the expected functionality for aarch64 is the same as for x64:
keep the preceding underscore.

Here is a long-running thread about supporting Windows/MSVC on Arm:
/messages/by-id/CAFPTBD-74+AEuN9n7caJ0YUnW5A0r-KBX8rYoEJWqFPgLKpzdg@mail.gmail.com

The patch you sent is part of the overall patch set being discussed
there but it is not sufficient by itself.