public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libgomp: Add RTEMS support
@ 2015-03-13 10:38 Sebastian Huber
  2015-03-13 10:44 ` Jakub Jelinek
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Huber @ 2015-03-13 10:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: devel, Sebastian Huber

I would like to commit this patch to GCC 4.9 and 5.0.

libgomp/ChangeLog
2015-03-13  Sebastian Huber  <sebastian.huber@embedded-brains.de>

	* configure.tgt (*-*-rtems*): Use local-exec TLS model.
	* configure.ac (*-*-rtems*): Assume Pthread is supported.
	(pthread.h): Check for this header file.
	* configure: Regenerate.
---
 libgomp/configure     | 22 ++++++++++++++--------
 libgomp/configure.ac  | 42 ++++++++++++++++++++++++------------------
 libgomp/configure.tgt |  4 ++++
 3 files changed, 42 insertions(+), 26 deletions(-)

diff --git a/libgomp/configure b/libgomp/configure
index 0818707..e39787c 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -14611,7 +14611,7 @@ $as_echo "#define STRING_WITH_STRINGS 1" >>confdefs.h
 
 fi
 
-for ac_header in unistd.h semaphore.h sys/loadavg.h sys/time.h sys/time.h
+for ac_header in pthread.h unistd.h semaphore.h sys/loadavg.h sys/time.h sys/time.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -15033,14 +15033,19 @@ ac_config_commands="$ac_config_commands gstdint.h"
 
 
 
-# Check to see if -pthread or -lpthread is needed.  Prefer the former.
-# In case the pthread.h system header is not found, this test will fail.
 XPCFLAGS=""
-CFLAGS="$CFLAGS -pthread"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+case "$host" in
+  *-*-rtems*)
+    # RTEMS supports Pthreads, but the library is not available at GCC build time.
+    ;;
+  *)
+    # Check to see if -pthread or -lpthread is needed.  Prefer the former.
+    # In case the pthread.h system header is not found, this test will fail.
+    CFLAGS="$CFLAGS -pthread"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <pthread.h>
-   void *g(void *d) { return NULL; }
+       void *g(void *d) { return NULL; }
 int
 main ()
 {
@@ -15053,10 +15058,10 @@ if ac_fn_c_try_link "$LINENO"; then :
   XPCFLAGS=" -Wc,-pthread"
 else
   CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <pthread.h>
-     void *g(void *d) { return NULL; }
+         void *g(void *d) { return NULL; }
 int
 main ()
 {
@@ -15075,6 +15080,7 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
+esac
 
 # Plugins for offload execution, configure.ac fragment.  -*- mode: autoconf -*-
 #
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 4687b01..51e646d 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -170,28 +170,34 @@ AC_SUBST(libtool_VERSION)
 AC_STDC_HEADERS
 AC_HEADER_TIME
 ACX_HEADER_STRING
-AC_CHECK_HEADERS(unistd.h semaphore.h sys/loadavg.h sys/time.h sys/time.h)
+AC_CHECK_HEADERS(pthread.h unistd.h semaphore.h sys/loadavg.h sys/time.h sys/time.h)
 
 GCC_HEADER_STDINT(gstdint.h)
 
-# Check to see if -pthread or -lpthread is needed.  Prefer the former.
-# In case the pthread.h system header is not found, this test will fail.
 XPCFLAGS=""
-CFLAGS="$CFLAGS -pthread"
-AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
-  [#include <pthread.h>
-   void *g(void *d) { return NULL; }],
-  [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
- [XPCFLAGS=" -Wc,-pthread"],
- [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
-  AC_LINK_IFELSE(
-   [AC_LANG_PROGRAM(
-    [#include <pthread.h>
-     void *g(void *d) { return NULL; }],
-    [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
-   [],
-   [AC_MSG_ERROR([Pthreads are required to build libgomp])])])
+case "$host" in
+  *-*-rtems*)
+    # RTEMS supports Pthreads, but the library is not available at GCC build time.
+    ;;
+  *)
+    # Check to see if -pthread or -lpthread is needed.  Prefer the former.
+    # In case the pthread.h system header is not found, this test will fail.
+    CFLAGS="$CFLAGS -pthread"
+    AC_LINK_IFELSE(
+     [AC_LANG_PROGRAM(
+      [#include <pthread.h>
+       void *g(void *d) { return NULL; }],
+      [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
+     [XPCFLAGS=" -Wc,-pthread"],
+     [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
+      AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+        [#include <pthread.h>
+         void *g(void *d) { return NULL; }],
+        [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
+       [],
+       [AC_MSG_ERROR([Pthreads are required to build libgomp])])])
+esac
 
 m4_include([plugin/configfrag.ac])
 
diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt
index ad98de1..2970f6f 100644
--- a/libgomp/configure.tgt
+++ b/libgomp/configure.tgt
@@ -20,6 +20,10 @@ if test $gcc_cv_have_tls = yes ; then
     *-*-linux* | *-*-gnu*)
 	XCFLAGS="${XCFLAGS} -ftls-model=initial-exec"
 	;;
+
+    *-*-rtems*)
+	XCFLAGS="${XCFLAGS} -ftls-model=local-exec"
+	;;
   esac
 fi
 
-- 
1.8.4.5

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libgomp: Add RTEMS support
  2015-03-13 10:38 [PATCH] libgomp: Add RTEMS support Sebastian Huber
@ 2015-03-13 10:44 ` Jakub Jelinek
  2015-03-13 10:59   ` Sebastian Huber
  2015-03-31  7:24   ` Sebastian Huber
  0 siblings, 2 replies; 5+ messages in thread
From: Jakub Jelinek @ 2015-03-13 10:44 UTC (permalink / raw)
  To: Sebastian Huber; +Cc: gcc-patches, devel

On Fri, Mar 13, 2015 at 11:38:12AM +0100, Sebastian Huber wrote:
> I would like to commit this patch to GCC 4.9 and 5.0.
> 
> libgomp/ChangeLog
> 2015-03-13  Sebastian Huber  <sebastian.huber@embedded-brains.de>
> 
> 	* configure.tgt (*-*-rtems*): Use local-exec TLS model.
> 	* configure.ac (*-*-rtems*): Assume Pthread is supported.
> 	(pthread.h): Check for this header file.
> 	* configure: Regenerate.

Ok for trunk.
Please wait with the backports for a few weeks.

	Jakub

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libgomp: Add RTEMS support
  2015-03-13 10:44 ` Jakub Jelinek
@ 2015-03-13 10:59   ` Sebastian Huber
  2015-03-31  7:24   ` Sebastian Huber
  1 sibling, 0 replies; 5+ messages in thread
From: Sebastian Huber @ 2015-03-13 10:59 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches, devel

On 13/03/15 11:43, Jakub Jelinek wrote:
> On Fri, Mar 13, 2015 at 11:38:12AM +0100, Sebastian Huber wrote:
>> I would like to commit this patch to GCC 4.9 and 5.0.
>>
>> libgomp/ChangeLog
>> 2015-03-13  Sebastian Huber  <sebastian.huber@embedded-brains.de>
>>
>> 	* configure.tgt (*-*-rtems*): Use local-exec TLS model.
>> 	* configure.ac (*-*-rtems*): Assume Pthread is supported.
>> 	(pthread.h): Check for this header file.
>> 	* configure: Regenerate.
> Ok for trunk.
> Please wait with the backports for a few weeks.

Thanks for the quick review. I checked it in to trunk.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libgomp: Add RTEMS support
  2015-03-13 10:44 ` Jakub Jelinek
  2015-03-13 10:59   ` Sebastian Huber
@ 2015-03-31  7:24   ` Sebastian Huber
  2015-03-31  7:30     ` Jakub Jelinek
  1 sibling, 1 reply; 5+ messages in thread
From: Sebastian Huber @ 2015-03-31  7:24 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek



On 13/03/15 11:43, Jakub Jelinek wrote:
> On Fri, Mar 13, 2015 at 11:38:12AM +0100, Sebastian Huber wrote:
>> I would like to commit this patch to GCC 4.9 and 5.0.
>>
>> libgomp/ChangeLog
>> 2015-03-13  Sebastian Huber  <sebastian.huber@embedded-brains.de>
>>
>> 	* configure.tgt (*-*-rtems*): Use local-exec TLS model.
>> 	* configure.ac (*-*-rtems*): Assume Pthread is supported.
>> 	(pthread.h): Check for this header file.
>> 	* configure: Regenerate.
> Ok for trunk.
> Please wait with the backports for a few weeks.

May I back port this patch now? It would be nice to have it available in 
GCC 4.9.3.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libgomp: Add RTEMS support
  2015-03-31  7:24   ` Sebastian Huber
@ 2015-03-31  7:30     ` Jakub Jelinek
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Jelinek @ 2015-03-31  7:30 UTC (permalink / raw)
  To: Sebastian Huber; +Cc: gcc-patches

On Tue, Mar 31, 2015 at 09:24:30AM +0200, Sebastian Huber wrote:
> 
> 
> On 13/03/15 11:43, Jakub Jelinek wrote:
> >On Fri, Mar 13, 2015 at 11:38:12AM +0100, Sebastian Huber wrote:
> >>I would like to commit this patch to GCC 4.9 and 5.0.
> >>
> >>libgomp/ChangeLog
> >>2015-03-13  Sebastian Huber  <sebastian.huber@embedded-brains.de>
> >>
> >>	* configure.tgt (*-*-rtems*): Use local-exec TLS model.
> >>	* configure.ac (*-*-rtems*): Assume Pthread is supported.
> >>	(pthread.h): Check for this header file.
> >>	* configure: Regenerate.
> >Ok for trunk.
> >Please wait with the backports for a few weeks.
> 
> May I back port this patch now? It would be nice to have it available in GCC
> 4.9.3.

Yes.

	Jakub

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-31  7:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13 10:38 [PATCH] libgomp: Add RTEMS support Sebastian Huber
2015-03-13 10:44 ` Jakub Jelinek
2015-03-13 10:59   ` Sebastian Huber
2015-03-31  7:24   ` Sebastian Huber
2015-03-31  7:30     ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).