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@
@[email protected]]
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 ([email protected])
src/tools/msvc_gendef.pl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/tools/msvc_gendef.pl b/src/tools/msvc_gendef.pl
index 404076dbbc..c23320b1d2 100644
--- a/src/tools/msvc_gendef.pl
+++ b/src/tools/msvc_gendef.pl
@@ -122,7 +122,7 @@ sub writedef
# Strip the leading underscore for win32, but not x64
$f =~ s/^_//
- unless ($arch eq "x86_64");
+ unless ($arch eq 'x86_64' || $arch eq 'aarch64');
# Emit just the name if it's a function symbol, or emit the name
# decorated with the DATA option for variables.
@@ -143,7 +143,7 @@ sub writedef
sub usage
{
die("Usage: msvc_gendef.pl --arch <arch> --deffile <deffile> --tempdir
<tempdir> files-or-directories\n"
- . " arch: x86 | x86_64\n"
+ . " arch: x86 | x86_64 | aarch64\n"
. " deffile: path of the generated file\n"
. " tempdir: directory for temporary files\n"
. " files or directories: object files or directory
containing object files\n"
@@ -160,7 +160,7 @@ GetOptions(
'tempdir:s' => \$tempdir,) or usage();
usage("arch: $arch")
- unless ($arch eq 'x86' || $arch eq 'x86_64');
+ unless ($arch eq 'x86' || $arch eq 'x86_64' || $arch eq 'aarch64');
my @files;