Web lists-archives.com

Re: [Mingw-users] GCC-4.9.3 is now our current release




Im sending you a patch against current pthreads-w32 from git that works with gcc-5.3.0 now.

I've commented my changes to the best of my ability hope they help.
Some of my changes might need a better solution but it works now,
and might help the pthreads-w32 dev to find a solution.

Den 14-03-2016 kl. 20:29 skrev Keith Marshall:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/03/16 09:04, ralph engels wrote:
If you are interrested, i just uploaded a full build of
gcc-5.3.0-dwarf2 that does not depend on winpthreads. you are
welcome to put it in the contributed section.
I'm much more interested to learn...

...

It did need some patching to get around the fact that the latest
gcc releases are targeted more at the mingw-w64 runtime, and some
bugs that where discovered later like the static __EH_FRAME__ bug
that caused the builds to fail even on mingw-w64.
...what you needed to do to get around this, which has been the show
stopper for me, for every GCC-5.x I've tried to build.  Until I can
build it consistently for *both* native deployment, *and* as a Linux
hosted cross-compiler, I'm not willing to offer it for download from
MinGW.org's SF file repositories.

Btw no gcc release after gcc-5.0.0 seem to be able to build
against pthreads-w32 not even if fixing the double definition of
timespec in pthread.h.
What version of pthreads-w32 are you trying?  v2.9.1 has been a source
of considerable trouble for me, but I'm having much more success with
current git trunk, (in conjunction with GCC-4.9.3).

- -- Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iQIcBAEBAgAGBQJW5xEgAAoJEMCtNsY0flo/tC8QAIfK2jeOw/h06oXXQMFGO+4q
flGRBNlDy2RBd4GPQIYvRhE/MXDJGoOZWKFhuM1INqUyc/+2CMybifDms9Oc4/PS
9p/5GANjxk1DjyQy6lk5SRiQtv8iYU0lWDi9PCU+ERn4VyKksDKqkJztQiB5vx+L
HVtUArwmUvgm1m2pY3Rfmi92pw3uqCz0+dqM6tcH0DJ7ogVAew5RadBji7VgOKky
Rh8ADzlQbHgiATeshM/kyc3QpqGWABbAJaEK5Zkl0Ep8tzB70xxc/TTCEpNa7vLr
/DYVBGbALGENjLky820GSSt7vtNYcoL1b2hMZzA/l6Kh/xjQOtQ0+NjMrME+X+vA
ZWvTdaYqTS1WgzYEeo2PpkzDxU5rxex0Y/Ojo9q2nk67BIyahZiXS7urzx9Hi+uC
OETUXSoK200iAyFuSqT5g3AzbMvTvMZ55SvnvXR2F8GxNm4TnHP+z3oFQ9EPdsZO
TZ84ubkEACO4rZasavbY/7wZYhDmD8ev5jnynnQEdfMhhgfqOa+RXqkV52isB/t+
vg0E6T2rOeUktJIKwHUH1dv3VC6hWlLxYDkDVhrKN8weREUwY6ic5JNhGiWRBwdH
6EXfkQZl149MOGd4U8132btoYm8ExSqHxKaucd97Fj6uZNDO7ln88ATOTETPj2rx
D1fc6M8585P88182uSUH
=93o9
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe

 GNUmakefile        |  2 +-
 README.NONPORTABLE |  2 +-
 config.h           |  4 +++-
 pthread.h          | 49 ++++++++++++++++++++++++++++++-------------------
 sched.h            |  9 ++++++---
 semaphore.h        |  7 +++++--
 6 files changed, 46 insertions(+), 27 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 855bc42..e4458a1 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -90,7 +90,7 @@ OD_PRIVATE	= $(CROSS)objdump -p
 SUPPORTED_TARGETS	= $(filter pe-% pei-% elf32-% elf64-% srec symbolsrec verilog tekhex binary ihex,$(shell $(RC) --help))
 RC_TARGET			= --target $(firstword $(filter $(SUPPORTED_TARGETS),$(shell $(OD_PRIVATE) *.$(OBJEXT))))
 
-OPT		=  $(CLEANUP) -O3 # -finline-functions -findirect-inlining
+OPT		=  $(CLEANUP) -O2 -fomit-frame-pointer # -finline-functions -findirect-inlining
 XOPT	= 
 
 RCFLAGS	= --include-dir=.
diff --git a/README.NONPORTABLE b/README.NONPORTABLE
index 7c39a56..1f732e3 100644
--- a/README.NONPORTABLE
+++ b/README.NONPORTABLE
@@ -84,7 +84,7 @@ pthread_getw32threadid_np (pthread_t thread)
 	thread "thread" is running as.
 
         Only valid when the library is built where
-        ! (defined(__MINGW64__) || defined(__MINGW32__)) || defined (__MSVCRT__) || defined (__DMC__)
+        ! (defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW32__)) || defined (__MSVCRT__) || defined (__DMC__)
         and otherwise returns 0.
 
 
diff --git a/config.h b/config.h
index 91a83f9..b9cc423 100644
--- a/config.h
+++ b/config.h
@@ -137,11 +137,13 @@
 #define HAVE_C_INLINE
 #endif
 
-#if defined(__MINGW64__)
+#if defined(__MINGW64_VERSION_MAJOR)
 #define HAVE_MODE_T
 #define HAVE_STRUCT_TIMESPEC
 #elif defined(__MINGW32__)
 #define HAVE_MODE_T
+/* mingwrt-3.21.1 has this */
+#define HAVE_STRUCT_TIMESPEC
 #undef MINGW_HAS_SECURE_API
 #endif
 
diff --git a/pthread.h b/pthread.h
index bb6faf2..6221679 100644
--- a/pthread.h
+++ b/pthread.h
@@ -107,7 +107,9 @@
 #define PTW32_LEVEL PTW32_LEVEL_MAX	/* Include everything */
 #endif
 
-#if defined(__MINGW32__) || defined(__MINGW64__)
+/* the __MINGW64__ define has not been used for some time and was removed because it was broken, 
+   we use __MINGW64_VERSION_MAJOR these days to distinguish between mingw.org and mingw-w64 */
+#if defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR)
 #  define PTW32_CONFIG_MINGW
 #endif
 #if defined(_MSC_VER)
@@ -192,11 +194,13 @@
  * -------------------------------------------------------------
  */
 
-/* Try to avoid including windows.h */
-#if defined(PTW32_CONFIG_MINGW) && defined(__cplusplus)
+/* Only include windows.h at build time */
+#if defined(PTW32_CONFIG_MINGW) && defined(PTW32_BUILD) && defined(__cplusplus)
 #define PTW32_INCLUDE_WINDOWS_H
 #endif
 
+/* cannot include windows.h because the OPTIONAL define in windef.h,
+   conflicts with the enum in gcc's genmodes.c */
 #if defined(PTW32_INCLUDE_WINDOWS_H)
 #include <windows.h>
 #endif
@@ -222,16 +226,25 @@ enum {
 #    define HAVE_MODE_T
 #    define HAVE_STRUCT_TIMESPEC
 #    define HAVE_SIGNAL_H
-#  elif defined(__MINGW64__)
+#  elif defined(__MINGW64_VERSION_MAJOR)
 #    define HAVE_STRUCT_TIMESPEC
 #    define HAVE_MODE_T
 #  elif defined(__MINGW32__)
 #    define HAVE_MODE_T
+#	 define HAVE_STRUCT_TIMESPEC
 #  elif defined(_MSC_VER) && _MSC_VER >= 1900
 #    define HAVE_STRUCT_TIMESPEC
 #  endif
 #endif
 
+#if PTW32_LEVEL >= PTW32_LEVEL_MAX
+#if defined(NEED_ERRNO)
+#include "need_errno.h"
+#else
+#include <errno.h>
+#endif
+#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
+
 #if !defined(NEED_FTIME)
 #include <time.h>
 #else /* NEED_FTIME */
@@ -244,16 +257,6 @@ enum {
 
 #include <limits.h>
 
-#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-#if defined(NEED_ERRNO)
-#include "need_errno.h"
-#else
-#include <errno.h>
-#endif
-#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
-
-#include <sched.h>
-
 /*
  * Several systems don't define some error numbers.
  */
@@ -285,6 +288,8 @@ enum {
 #  define ENOTRECOVERABLE 44
 #endif
 
+#include <sched.h>
+
 /*
  * To avoid including windows.h we define only those things that we
  * actually need from it.
@@ -324,8 +329,7 @@ struct timespec {
 #endif /* SIG_SETMASK */
 
 #if defined(__cplusplus)
-extern "C"
-{
+extern "C" {
 #endif                          /* __cplusplus */
 
 /*
@@ -553,7 +557,7 @@ extern "C"
 #  endif
 
 #if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX
-#   include     <sys/types.h>
+#   include <sys/types.h>
 #else
 /*
  * Generic handle type - intended to extend uniqueness beyond
@@ -561,11 +565,18 @@ extern "C"
  * IA-32 or IA-64.
  */
 typedef struct {
-    void * p;                   /* Pointer to actual object */
-    unsigned int x;             /* Extra information - reuse count etc */
+    void * p;                /* Pointer to actual object */
+    unsigned int x;          /* Extra information - reuse count etc */
 } ptw32_handle_t;
 
+/* only use ptw32_handle_t internally, 
+   gcc expects this to be a simple pointer to an unsigned type (scalar) */
+#if defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR) && defined(PTW32_BUILD)
 typedef ptw32_handle_t pthread_t;
+#else
+/* should be uintptr_t but what the heck */
+typedef unsigned int pthread_t;
+#endif
 typedef struct pthread_attr_t_ * pthread_attr_t;
 typedef struct pthread_once_t_ pthread_once_t;
 typedef struct pthread_key_t_ * pthread_key_t;
diff --git a/sched.h b/sched.h
index d8a7114..8809bbe 100644
--- a/sched.h
+++ b/sched.h
@@ -124,10 +124,13 @@
 #    define NEED_ERRNO
 #    define NEED_SEM
 #  endif
-#  if defined(__MINGW64__)
+#  if defined(__MINGW64_VERSION_MAJOR)
 #    define HAVE_STRUCT_TIMESPEC
 #    define HAVE_MODE_T
-#  elif defined(_UWIN) || defined(__MINGW32__)
+#  elif defined(__MINGW32__)
+#    define HAVE_MODE_T
+#	 define HAVE_STRUCT_TIMESPEC
+#  elif defined(_UWIN)
 #    define HAVE_MODE_T
 #  endif
 #endif
@@ -146,7 +149,7 @@
 #endif
 #endif /* PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX */
 
-#if (defined(__MINGW64__) || defined(__MINGW32__)) || defined(_UWIN)
+#if (defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW32__)) || defined(_UWIN)
 # if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX
 /* For pid_t */
 #  include <sys/types.h>
diff --git a/semaphore.h b/semaphore.h
index b67845d..3a565ff 100644
--- a/semaphore.h
+++ b/semaphore.h
@@ -103,10 +103,13 @@
 #    define NEED_ERRNO
 #    define NEED_SEM
 #  endif
-#  if defined(__MINGW64__)
+#  if defined(__MINGW64_VERSION_MAJOR)
 #    define HAVE_STRUCT_TIMESPEC
 #    define HAVE_MODE_T
-#  elif defined(_UWIN) || defined(__MINGW32__)
+#  elif defined(__MINGW32__)
+#    define HAVE_MODE_T
+#	 define HAVE_STRUCT_TIMESPEC
+#  elif defined(_UWIN)
 #    define HAVE_MODE_T
 #  endif
 #endif
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe