#2289 closed defect (fixed)

rtems_ada_self is broken on SMP

Reported by: Sebastian Huber Owned by: Needs Funding
Priority: normal Milestone: 5.1
Component: tool/gcc Version:
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

The global variable rtems_ada_self is broken on SMP (similar to the task variables) and should be replaced with a function call or thread specific data.

Change History (15)

comment:1 Changed on 01/26/17 at 07:16:00 by Sebastian Huber

Milestone: 4.11.14.11.2

comment:2 Changed on 02/15/17 at 13:37:51 by Sebastian Huber

Milestone: 4.11.2Indefinite
Owner: set to Needs Funding
Status: newassigned

comment:3 Changed on 03/07/17 at 10:07:12 by Sebastian Huber

Resolution: duplicate
Status: assignedclosed

Duplicate of #2835.

comment:4 Changed on 05/23/17 at 08:01:52 by Sebastian Huber

Resolution: duplicate
Status: closedreopened
Version: 4.11

One option is to use TLS, e.g.

diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 598b262d914..5e1c5286d63 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1743,7 +1743,7 @@ ifeq ($(strip $(filter-out rtems%,$(target_os))),)
   s-parame.adb<s-parame-rtems.adb \
   s-taprop.adb<s-taprop-posix.adb \
   s-taspri.ads<s-taspri-posix.ads \
-  s-tpopsp.adb<s-tpopsp-rtems.adb \
+  s-tpopsp.adb<s-tpopsp-tls.adb \
   s-stchop.adb<s-stchop-rtems.adb \
   s-interr.adb<s-interr-hwint.adb
 endif

Another option is to use POSIX keys:

diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 598b262d914..5e1c5286d63 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1743,7 +1743,7 @@ ifeq ($(strip $(filter-out rtems%,$(target_os))),)
   s-parame.adb<s-parame-rtems.adb \
   s-taprop.adb<s-taprop-posix.adb \
   s-taspri.ads<s-taspri-posix.ads \
-  s-tpopsp.adb<s-tpopsp-rtems.adb \
+  s-tpopsp.adb<s-tpopsp-posix.adb \
   s-stchop.adb<s-stchop-rtems.adb \
   s-interr.adb<s-interr-hwint.adb
 endif

I tend to use TLS since it has less overhead.

comment:5 Changed on 06/02/17 at 08:32:56 by Sebastian Huber <sebastian.huber@…>

In 3623c40/rtems:

ada-tests/spatcb01: New test

Update #2289.

comment:7 Changed on 06/07/17 at 13:12:16 by Joel Sherrill

Just to be clear. We are using keys now for Ada. Does confdefs.h reflect this?

comment:8 Changed on 06/07/17 at 13:19:36 by Sebastian Huber

No, we used a hand crafted task variable for this. I will update RTEMS once the RSB is updated. Need to backport the GCC change to GCC 7 branch before.

comment:9 Changed on 06/07/17 at 13:52:17 by Sebastian Huber

This change breaks the x86 Ada support as long as x86 has no TLS support.

comment:10 Changed on 06/07/17 at 17:49:23 by Joel Sherrill

So we are now using TLS for Ada.Self. I was thinking the POSIX default code used keys. That was the original implementation in GNAT. Is it TLS or POSIX keys?

comment:11 Changed on 06/08/17 at 05:29:44 by Sebastian Huber

On Linux and vxWorks TLS is used.

comment:12 Changed on 06/12/17 at 11:53:01 by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: reopenedclosed

In c336dc9/rtems-source-builder:

4.12: Add SMP support for Ada of GCC 7.1

Close #2289.

comment:13 Changed on 06/12/17 at 11:54:23 by Sebastian Huber

Milestone: Indefinite4.12.0

comment:14 Changed on 06/14/17 at 05:31:18 by Sebastian Huber <sebastian.huber@…>

In 3dd67dd1/rtems:

score: Remove rtems_ada_self

This task variable is superfluous since we use thread-local storage now.

Update #2289.

comment:15 Changed on 11/09/17 at 06:27:14 by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.