Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5a5c2fe

Browse files
committed
Absorb -D_USE_32BIT_TIME_T switch from Perl, if relevant.
Commit3c163a7's original choice to ignore all #define symbols whosenames begin with underscore turns out to be too simplistic. On Windows,some Perl installations are built with -D_USE_32BIT_TIME_T, and we mustabsorb that or we get the wrong result for sizeof(PerlInterpreter).This effectively re-reverts commitef58b87, which injected that symbolin 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 whenthe Perl build to be used did not select this option; so that it failsto work properly with some newer Perl builds.By making this change, we would be introducing an ABI break in 32-bitWindows builds; but fortunately we have not used type time_t in anyexported Postgres APIs in a long time. So it should be OK, both forPL/Perl itself and for third-party extensions, if an extension libraryis 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 commit3c163a7 was.Discussion:https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
1 parentea0ca75 commit5a5c2fe

File tree

5 files changed

+12
-20
lines changed

5 files changed

+12
-20
lines changed

‎config/perl.m4

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ AC_DEFUN([PGAC_CHECK_PERL_CONFIGS],
5656
# to a different libc ABI than core Postgres uses. The available information
5757
# says that all the symbols that affect Perl's own ABI begin with letters,
5858
# so it should be sufficient to adopt -D switches for symbols not beginning
59-
# with underscore.
59+
# with underscore. An exception is that we need to let through
60+
# -D_USE_32BIT_TIME_T if it's present. (We probably could restrict that to
61+
# only get through on Windows, but for the moment we let it through always.)
6062
# For debugging purposes, let's have the configure output report the raw
6163
# ccflags value as well as the set of flags we chose to adopt.
6264
AC_DEFUN([PGAC_CHECK_PERL_EMBED_CCFLAGS],
@@ -65,7 +67,7 @@ AC_MSG_CHECKING([for CFLAGS recommended by Perl])
6567
perl_ccflags=`$PERL -MConfig -e['print $Config{ccflags}']`
6668
AC_MSG_RESULT([$perl_ccflags])
6769
AC_MSG_CHECKING([for CFLAGS to compile embedded Perl])
68-
perl_embed_ccflags=`$PERL -MConfig -e['foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[^_]/)}']`
70+
perl_embed_ccflags=`$PERL -MConfig -e['foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[^_]/ || $f =~ /^-D_USE_32BIT_TIME_T/)}']`
6971
AC_SUBST(perl_embed_ccflags)dnl
7072
AC_MSG_RESULT([$perl_embed_ccflags])
7173
])# PGAC_CHECK_PERL_EMBED_CCFLAGS

‎configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7866,7 +7866,7 @@ perl_ccflags=`$PERL -MConfig -e 'print $Config{ccflags}'`
78667866
$as_echo"$perl_ccflags">&6; }
78677867
{$as_echo"$as_me:${as_lineno-$LINENO}: checking for CFLAGS to compile embedded Perl">&5
78687868
$as_echo_n"checking for CFLAGS to compile embedded Perl...">&6; }
7869-
perl_embed_ccflags=`$PERL -MConfig -e'foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[^_]/)}'`
7869+
perl_embed_ccflags=`$PERL -MConfig -e'foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[^_]/ || $f =~ /^-D_USE_32BIT_TIME_T/)}'`
78707870
{$as_echo"$as_me:${as_lineno-$LINENO}: result:$perl_embed_ccflags">&5
78717871
$as_echo"$perl_embed_ccflags">&6; }
78727872

‎src/tools/msvc/MSBuildProject.pm

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,16 @@ EOF
6363
</PropertyGroup>
6464
EOF
6565

66-
# We have to use this flag on 32 bit targets because the 32bit perls
67-
# are built with it and sometimes crash if we don't.
68-
my$use_32bit_time_t =
69-
$self->{platform}eq'Win32' ?'_USE_32BIT_TIME_T;' :'';
70-
7166
$self->WriteItemDefinitionGroup(
7267
$f,'Debug',
73-
{defs=>"_DEBUG;DEBUG=1;$use_32bit_time_t",
68+
{defs=>"_DEBUG;DEBUG=1",
7469
opt=>'Disabled',
7570
strpool=>'false',
7671
runtime=>'MultiThreadedDebugDLL' });
7772
$self->WriteItemDefinitionGroup(
7873
$f,
7974
'Release',
80-
{defs=>"$use_32bit_time_t",
75+
{defs=>"",
8176
opt=>'Full',
8277
strpool=>'true',
8378
runtime=>'MultiThreadedDLL' });

‎src/tools/msvc/Mkvcbuild.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,14 +522,15 @@ sub mkvcbuild
522522
my@perl_embed_ccflags;
523523
foreachmy$f (split("",$Config{ccflags}))
524524
{
525-
if ($f =~/^-D[^_]/)
525+
if ($f =~/^-D[^_]/ ||
526+
$f =~/^-D_USE_32BIT_TIME_T/)
526527
{
527528
$f =~s/\-D//;
528529
push(@perl_embed_ccflags,$f);
529530
}
530531
}
531532

532-
#XXX this probably is redundant now?
533+
#Also, a hack to prevent duplicate definitions of uid_t/gid_t
533534
push(@perl_embed_ccflags,'PLPERL_HAVE_UID_GID');
534535

535536
foreachmy$f (@perl_embed_ccflags)

‎src/tools/msvc/VCBuildProject.pm

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,17 @@ sub WriteHeader
3333
<Configurations>
3434
EOF
3535

36-
# We have to use this flag on 32 bit targets because the 32bit perls
37-
# are built with it and sometimes crash if we don't.
38-
my$use_32bit_time_t =
39-
$self->{platform}eq'Win32' ?'_USE_32BIT_TIME_T;' :'';
40-
41-
4236
$self->WriteConfiguration(
4337
$f,'Debug',
44-
{defs=>"_DEBUG;DEBUG=1;$use_32bit_time_t",
38+
{defs=>"_DEBUG;DEBUG=1",
4539
wholeopt=> 0,
4640
opt=> 0,
4741
strpool=>'false',
4842
runtime=> 3 });
4943
$self->WriteConfiguration(
5044
$f,
5145
'Release',
52-
{defs=>"$use_32bit_time_t",
46+
{defs=>"",
5347
wholeopt=> 0,
5448
opt=> 3,
5549
strpool=>'true',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp