Re: [Mingw-w64-public] inttypes Format Specifiers

2018-10-26 Thread Mateusz
W dniu 26.10.2018 o 22:35, Tom Ritter pisze:
> This is not really a MinGW problem, but MinGW does diverge from other
> compilers and it caused Firefox to crash.
> 
> MinGW defines a lot of I64[foo] format specifiers in inttypes.h.
> clang and clang-cl don't use I64[foo] they use ll[foo]. (I64[foo] is
> valid according to Microsoft. MinGW mentions "MS runtime does not yet
> understand C9x standard "ll"" but at some point they started
> supporting ll[foo].  And as I mentioned, that's what clang[-cl] uses.
> 
> Mozilla has our own implementation of printf that does the format
> specifier parsing. We don't support I64[foo]. So using it caused data
> corruption and general bad behavior. Switching to ll[foo] fixed it.
> 
> I have a patch here:
> https://hg.mozilla.org/try/raw-file/eaae7782a1dd/build/build-clang/mingw-int.patch

You can try to define
__USE_MINGW_ANSI_STDIO
instead of patching mingw-w64



___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] inttypes Format Specifiers

2018-10-26 Thread Tom Ritter
This is not really a MinGW problem, but MinGW does diverge from other
compilers and it caused Firefox to crash.

MinGW defines a lot of I64[foo] format specifiers in inttypes.h.
clang and clang-cl don't use I64[foo] they use ll[foo]. (I64[foo] is
valid according to Microsoft. MinGW mentions "MS runtime does not yet
understand C9x standard "ll"" but at some point they started
supporting ll[foo].  And as I mentioned, that's what clang[-cl] uses.

Mozilla has our own implementation of printf that does the format
specifier parsing. We don't support I64[foo]. So using it caused data
corruption and general bad behavior. Switching to ll[foo] fixed it.

I have a patch here:
https://hg.mozilla.org/try/raw-file/eaae7782a1dd/build/build-clang/mingw-int.patch

(Try run for Firefox is here if anyone is interested:
https://treeherder.mozilla.org/#/jobs?repo=try=5db7504d12cf2e5181f2fcd46e09df37e0e80159=208082989
)

It may be desirable to take this patch, even though I64[foo] is valid,
just because ll[foo] is much more common and it will unify behavior
across compilers.  (It would also be helpful for me; but we can
support local patches to MinGW if you don't want to upstream this.)

I64[foo] -> ll[foo] is not the only difference. The following
illustrates other differences:
https://ritter.vg/misc/transient/format-specifiers-diff.html

-tom


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] Add source files for pseh and change build system accordingly

2018-10-26 Thread James Larrowe
Note: there are symlinks from i386 to i486, i586, and i686 that I couldn't
get to show up in the patch.
This patch adds pseh files for x86_64 and changes the build system
accordingly so pseh can be built for x86_64.
Please tell me if there's anything wrong with this.

diff -Naur --no-dereference a/mingw-w64/mingw-w64-libraries/pseh/configure
b/mingw-w64/mingw-w64-libraries/pseh/configure
--- a/mingw-w64/mingw-w64-libraries/pseh/configure2018-10-21
19:43:00.455270976 -0400
+++ b/mingw-w64/mingw-w64-libraries/pseh/configure2018-10-26
11:06:18.133426429 -0400
@@ -706,6 +706,7 @@
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -780,6 +781,7 @@
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1032,6 +1034,15 @@
   | -silent | --silent | --silen | --sile | --sil)
 silent=yes ;;

+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
 ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1169,7 +1180,7 @@
 for ac_var inexec_prefix prefix bindir sbindir libexecdir datarootdir \
 datadir sysconfdir sharedstatedir localstatedir includedir \
 oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-libdir localedir mandir
+libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1322,6 +1333,7 @@
   --sysconfdir=DIRread-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIRmodifiable architecture-independent data
[PREFIX/com]
   --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR   modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIRobject code libraries [EPREFIX/lib]
   --includedir=DIRC header files [PREFIX/include]
   --oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -2734,15 +2746,6 @@



-case $host in #(
-  i*86-*-mingw*) :
- ;; #(
-  *) :
-as_fn_error $? "Only x86 32-bit Win32 host variants are supported"
"$LINENO" 5 ;; #(
-  *) :
- ;;
-esac
-
 # Checks for programs.
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
diff -Naur --no-dereference a/mingw-w64/mingw-w64-libraries/pseh/
configure.ac b/mingw-w64/mingw-w64-libraries/pseh/configure.ac
--- a/mingw-w64/mingw-w64-libraries/pseh/configure.ac2018-10-21
19:43:00.455270976 -0400
+++ b/mingw-w64/mingw-w64-libraries/pseh/configure.ac2018-10-21
19:48:58.0 -0400
@@ -11,10 +11,6 @@

 AC_CANONICAL_HOST

-AS_CASE([$host],
-[i*86-*-mingw*],[],
-[*],[AC_MSG_ERROR([Only x86 32-bit Win32 host variants are
supported])])
-
 # Checks for programs.
 AC_PROG_CC
 AC_PROG_RANLIB
diff -Naur --no-dereference
a/mingw-w64/mingw-w64-libraries/pseh/Makefile.am
b/mingw-w64/mingw-w64-libraries/pseh/Makefile.am
--- a/mingw-w64/mingw-w64-libraries/pseh/Makefile.am2018-10-21
19:43:00.455270976 -0400
+++ b/mingw-w64/mingw-w64-libraries/pseh/Makefile.am2018-10-26
11:05:36.053217764 -0400
@@ -6,10 +6,10 @@
 lib_LIBRARIES = libpseh.a

 libpseh_a_SOURCES = \
-  src/framebased.c \
-  src/i386/framebased-gcchack-asm.S \
-  src/i386/framebased-gcchack.c \
-  src/i386/framebased.S
+src/@host_cpu@/framebased.c \
+src/@host_cpu@/framebased-gcchack-asm.S \
+src/@host_cpu@/framebased-gcchack.c \
+src/@host_cpu@/framebased-asm.S

 psehdir = $(includedir)/pseh
 framebaseddir = $(psehdir)/framebased
diff -Naur --no-dereference
a/mingw-w64/mingw-w64-libraries/pseh/Makefile.in
b/mingw-w64/mingw-w64-libraries/pseh/Makefile.in
--- a/mingw-w64/mingw-w64-libraries/pseh/Makefile.in2018-10-21
19:43:00.455270976 -0400
+++ b/mingw-w64/mingw-w64-libraries/pseh/Makefile.in2018-10-26
11:06:19.229431863 -0400
@@ -142,10 +142,10 @@
 libpseh_a_AR = $(AR) $(ARFLAGS)
 libpseh_a_LIBADD =
 am__dirstamp = $(am__leading_dot)dirstamp
-am_libpseh_a_OBJECTS = src/framebased.$(OBJEXT) \
-src/i386/framebased-gcchack-asm.$(OBJEXT) \
-src/i386/framebased-gcchack.$(OBJEXT) \
-src/i386/framebased.$(OBJEXT)
+am_libpseh_a_OBJECTS = src/@host_cpu@/framebased.$(OBJEXT) \
+src/@host_cpu@/framebased-gcchack-asm.$(OBJEXT) \
+src/@host_cpu@/framebased-gcchack.$(OBJEXT) \
+src/@host_cpu@/framebased-asm.$(OBJEXT)
 libpseh_a_OBJECTS = $(am_libpseh_a_OBJECTS)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -328,6 +328,7 @@
 prefix = @prefix@
 program_transform_name =