#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 Jan 26, 2017 at 7:16:00 AM by Sebastian Huber

Milestone: 4.11.14.11.2

comment:2 Changed on Feb 15, 2017 at 1:37:51 PM by Sebastian Huber

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

comment:3 Changed on Mar 7, 2017 at 10:07:12 AM by Sebastian Huber

Resolution: duplicate
Status: assignedclosed

Duplicate of #2835.

comment:4 Changed on May 23, 2017 at 8:01:52 AM 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 Jun 2, 2017 at 8:32:56 AM by Sebastian Huber <sebastian.huber@…>

In 3623c40/rtems:

ada-tests/spatcb01: New test

Update #2289.

comment:7 Changed on Jun 7, 2017 at 1:12:16 PM by Joel Sherrill

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

comment:8 Changed on Jun 7, 2017 at 1:19:36 PM 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 Jun 7, 2017 at 1:52:17 PM by Sebastian Huber

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

comment:10 Changed on Jun 7, 2017 at 5:49:23 PM 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 Jun 8, 2017 at 5:29:44 AM by Sebastian Huber

On Linux and vxWorks TLS is used.

comment:12 Changed on Jun 12, 2017 at 11:53:01 AM 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 Jun 12, 2017 at 11:54:23 AM by Sebastian Huber

Milestone: Indefinite4.12.0

comment:14 Changed on Jun 14, 2017 at 5:31:18 AM 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 Nov 9, 2017 at 6:27:14 AM by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.