New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XS with <= VC2003 has different interp struct against >= VC2005 Perl, ABI/segv #13667
Comments
From @bulk88Created by @bulk88Continuing from bulk88 wrote:
@@ -112973,9 +192597,50 @@
#pragma pack(pop)
-#line 639 "C:\\Program Files\\Microsoft Visual Studio .NET
2003\\VC7\\INCLUDE\\math.h"
-
-#line 641 "C:\\Program Files\\Microsoft Visual Studio .NET
2003\\VC7\\INCLUDE\\math.h"
+#line 594 "C:\\Program Files (x86)\\Microsoft Visual Studio
9.0\\VC\\INCLUDE\\math.h"
+
+#line 596 "C:\\Program Files (x86)\\Microsoft Visual Studio
9.0\\VC\\INCLUDE\\math.h"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#line 636 "C:\\Program Files (x86)\\Microsoft Visual Studio
9.0\\VC\\INCLUDE\\math.h"
+
#line 3834 "C:\\perl519\\lib\\CORE\\perl.h"
@@ -116243,6 +195908,7 @@
+
#line 12 "c:\\perl519\\lib\\core\\intrpvar.h"
@@ -116403,8 +196069,8 @@
-struct _stati64 Istatbuf;
-struct _stati64 Istatcache;
+struct _stat64 Istatbuf;
+struct _stat64 Istatcache;
GV * Istatgv;
SV * Istatname;
@@ -118632,7 +198298,7 @@
;
-__declspec(dllimport) char Perl_cando(PerlInterpreter* my_perl ,
mode_t mode, char effective, const struct _stati64* statbufp)
+__declspec(dllimport) char Perl_cando(PerlInterpreter* my_perl ,
mode_t mode, char effective, const struct _stat64* statbufp)
;
@@ -126405,6 +206071,7 @@
+
#line 5011 "C:\\perl519\\lib\\CORE\\perl.h" What are those 2 structs for Istatbuf? From 2003 line 114 "C:\\Program Files\\Microsoft Visual Studio .NET 2003\\VC7\\INCLUDE\\sys/stat.h"#line 114 "C:\\Program Files\\Microsoft Visual Studio .NET
2003\\VC7\\INCLUDE\\sys/stat.h"
struct _stati64 {
_dev_t st_dev;
_ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
__int64 st_size;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
};
struct __stat64 {
_dev_t st_dev;
_ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
__int64 st_size;
__time64_t st_atime;
__time64_t st_mtime;
__time64_t st_ctime;
}; from 2008struct _stat64 {
_dev_t st_dev;
_ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
__int64 st_size;
__time64_t st_atime;
__time64_t st_mtime;
__time64_t st_ctime;
}; Perl in dosish.h has#if defined(WIN64) || defined(USE_LARGE_FILES)
#define Stat_t struct _stati64
#else
#if defined(UNDER_CE)
#define Stat_t struct xcestat
#else
#define Stat_t struct stat
#endif
#endif Both of my perls took the 1st branch, because of USE_LARGE_FILES, and #ifdef _USE_32BIT_TIME_T
#define _fstat _fstat32
#define _fstati64 _fstat32i64
#define _stat _stat32
#define _stati64 _stat32i64
#define _wstat _wstat32
#define _wstati64 _wstat32i64
#else
#define _fstat _fstat64i32
#define _fstati64 _fstat64
#define _stat _stat64i32
#define _stati64 _stat64
#define _wstat _wstat64i32
#define _wstati64 _wstat64
#endif 2008's analog struct for 2003's _stati64 is: #line 135 "C:\\Program Files (x86)\\Microsoft Visual Studio
9.0\\VC\\INCLUDE\\sys/stat.h"
struct _stat32i64 {
_dev_t st_dev;
_ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
__int64 st_size;
__time32_t st_atime;
__time32_t st_mtime;
__time32_t st_ctime;
}; and 2003's analog struct for 2008's _stati64/_stat64 is, notice "__"struct __stat64 {
_dev_t st_dev;
_ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
__int64 st_size;
__time64_t st_atime;
__time64_t st_mtime;
__time64_t st_ctime;
}; See this commit by @jandubois for what is happening 45f6403
__declspec(dllimport) int win32_fstat(int fd,struct _stati64
*sbufptr);
__declspec(dllimport) int win32_stat(const char *name,struct
_stati64 *sbufptr); We have Stat_t as a Perl level token. This may need to be defined based Slightly related to the win32_* forward functions is my branch There is also #9029 but I dont think its related to your/this bug. Perl Info
|
From @bulk88On Sat Mar 15 22:01:09 2014, bulk88 wrote:
I forgot to consider GCC. Strawberry 5.16's GCC headers have #pragma pack(push,_CRT_PACKING) struct stat { struct _stati64 { struct _stat64i32 { struct _stat64 { interp struct section from SP. # 82 "C:\\sp3216\\perl\\lib\\CORE/intrpvar.h" struct _stati64 Istatbuf; struct tms Itimesbuf; PMOP * Icurpm; So GCC/Mingw thinks its a <= 2003, and its (strawberry's) Config.pm does NOT have _USE_32BIT_TIME_T. That isn't a mixed compiler build tho, nobody uses VC to compile XS with a Strawberry Perl (I've tried, lots of Config hacking, I gave up due to time). But there is a combo of VC Perl with GCC XS (btw, you are the maintainer of AP's dmake, see my ticket, https://rt.cpan.org/Public/Bug/Display.html?id=89440 ). ActivePerl <= 5.16 with the Mingw PPM packages is a common setup for some people. AP uses a AP-only module called ActivePerl::Config (.pm) to change Config's values to work with GCC. It is _USE_32BIT_TIME_T unaware (maybe because ActiveState never used > VC6, and instead switched to Mingw for 5.18). IDK how self compiled VC Perl works with GCC XS and IDK if there will be a _USE_32BIT_TIME_T defined for doshish.h in that case. So then a special case in doshish.h for Mingw is needed, but IDK exactly how to do it. Either test for Mingw or test for _USE_32BIT_TIME_T. Remember, this fix will obviously fix blead, but what stable's will it be in? any maint releases? what stables will it be retrofitted to? what are your requirements for supporting a fix? fix it in ppport.h? idk... -- |
From @bulk88Another fix idea is to just move PL_statcache and PL_statbuf to the end of the interp struct. -- |
From @bulk88Fixing Stat_t partially helped, compiling XS with VC 2003 with a VC 2005 Perl, before my fix, PL_LIO was at 0x8CC , after, 0x8DC, but its still not at 0x8E4 (correct offset) in VS 2005/2008. There is something else, not visible with diffing the interp struts after CPP, that is different. dosish.h patch #if defined(WIN64) || defined(USE_LARGE_FILES) void PPCODE: VC 2003 before patch, 00003039 is "12345", a fake number so no segv C:\sources\Foo-1.00>perl -MFoo -E"Foo::one" C:\sources\Foo-1.00> VC 2003 after patch C:\sources\Foo-1.00>perl -MFoo -E"Foo::one" C:\sources\Foo-1.00> VC 2005 (always correct, since this is VC 2005 Perl) C:\sources\Foo-1.00>perl -MFoo -E"Foo::one" C:\sources\Foo-1.00> -- |
From @bulk88On Sun Mar 16 01:58:05 2014, bulk88 wrote:
--- C:\sources\Foo-1.00\vc8.txt C:\sources\Foo-1.00>perl -MFoo -E"Foo::one" C:\sources\Foo-1.00> PL_e_script is a SV *. No drama can be there. PL_basetime is a time_t. typedef __int64 __time64_t; #line 25 "C:\\Program Files\\Microsoft Visual Studio .NET 2003\\VC7\\INCLUDE\\sys/types.h" VC2005 #ifdef _USE_32BIT_TIME_T #ifndef _TIME32_T_DEFINED #ifndef _TIME64_T_DEFINED #ifndef _TIME_T_DEFINED VC 2003 #ifndef _TIME_T_DEFINED VC 6 #ifndef _TIME_T_DEFINED So this is more tricky, Time_t is a Perl type, and its defined in config_H.vc but time_t isn't a Perl type, its a C type. config_H.vc is not XS compile time dynamic like dosish.h/headers. Also, its not in VC 6. How will this be fixed? -- |
@bulk88 Assuming we do not continue to use VC2003, is there something that needs to be done here? |
@steve-m-hay this case seems to have opened out of a issue you had. Does it still need to be pursued? https://groups.google.com/forum/#!msg/perl.perl5.porters/n8lNwjkp_wk/_Om-44Wqn-YJ |
Migrated from rt.perl.org#121448 (status was 'new')
Searchable as RT121448$
The text was updated successfully, but these errors were encountered: