diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-08-14 11:48:59 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-08-14 11:48:59 -0400 |
commit | 01de7ea85378798f2ce5da93fc5ebf5c81c2453f (patch) | |
tree | 57c5be0e8f3f48811a70073c4bf0bc47ff96e575 /src/tools/msvc/Mkvcbuild.pm | |
parent | 5a3688dc88ec9ea52bb81711235f9de42d13677d (diff) |
Absorb -D_USE_32BIT_TIME_T switch from Perl, if relevant.
Commit 3c163a7fc's original choice to ignore all #define symbols whose
names begin with underscore turns out to be too simplistic. On Windows,
some Perl installations are built with -D_USE_32BIT_TIME_T, and we must
absorb that or we get the wrong result for sizeof(PerlInterpreter).
This effectively re-reverts commit ef58b87df, which injected that symbol
in a hacky way, making it apply to all of Postgres not just PL/Perl.
More significantly, it did so on *all* 32-bit Windows builds, even when
the Perl build to be used did not select this option; so that it fails
to work properly with some newer Perl builds.
By making this change, we would be introducing an ABI break in 32-bit
Windows builds; but fortunately we have not used type time_t in any
exported Postgres APIs in a long time. So it should be OK, both for
PL/Perl itself and for third-party extensions, if an extension library
is built with a different _USE_32BIT_TIME_T setting than the core code.
Patch by me, based on research by Ashutosh Sharma and Robert Haas.
Back-patch to all supported branches, as commit 3c163a7fc was.
Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
Diffstat (limited to 'src/tools/msvc/Mkvcbuild.pm')
-rw-r--r-- | src/tools/msvc/Mkvcbuild.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index d7b64a4046e..109b3ee5633 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -145,14 +145,15 @@ sub mkvcbuild my @perl_embed_ccflags; foreach my $f (split(" ",$Config{ccflags})) { - if ($f =~ /^-D[^_]/) + if ($f =~ /^-D[^_]/ || + $f =~ /^-D_USE_32BIT_TIME_T/) { $f =~ s/\-D//; push(@perl_embed_ccflags, $f); } } - # XXX this probably is redundant now? + # Also, a hack to prevent duplicate definitions of uid_t/gid_t push(@perl_embed_ccflags, 'PLPERL_HAVE_UID_GID'); foreach my $f (@perl_embed_ccflags) |