[Ada] Use atomics in runtime on ARM and Aarch64 VxWorks

Message ID 20211109094610.GA830666@adacore.com
State Committed
Commit c8a0089baf7597baca757ee173a2a948c9697567
Headers
Series [Ada] Use atomics in runtime on ARM and Aarch64 VxWorks |

Commit Message

Pierre-Marie de Rodat Nov. 9, 2021, 9:46 a.m. UTC
  For ARM and Aarch64 architectures we use runtime units that rely on
atomic builtins instructions on all OSes except VxWorks (e.g. QNX,
Linux, FreeBSD). This looks like an oversight, because the builtins
depend on the architecture, not on the OS.

Part of improving efficiency of the Ada.Strings.Unbounded unit by using
non-null types to avoid runtime checks.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* Makefile.rtl (ARM and Aarch64 VxWorks): Use atomic variants of
	runtime units.
	* libgnat/a-strunb__shared.ads: Mention AARCH64 and ARM as
	supported.
	* libgnat/s-atocou.ads: Likewise.
  

Patch

diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1362,7 +1362,9 @@  ifeq ($(strip $(filter-out aarch64 arm% coff wrs vx%,$(target_cpu) $(target_vend
   g-socthi.ads<libgnat/g-socthi__vxworks.ads \
   g-socthi.adb<libgnat/g-socthi__vxworks.adb \
   g-sopowa.adb<libgnat/g-sopowa__posix.adb \
-  g-stsifd.adb<libgnat/g-stsifd__sockets.adb
+  g-stsifd.adb<libgnat/g-stsifd__sockets.adb \
+  $(ATOMICS_TARGET_PAIRS) \
+  $(ATOMICS_BUILTINS_TARGET_PAIRS)
 
   ifeq ($(strip $(filter-out aarch64, $(target_cpu))),)
     ARCH_STR=aarch64


diff --git a/gcc/ada/libgnat/a-strunb__shared.ads b/gcc/ada/libgnat/a-strunb__shared.ads
--- a/gcc/ada/libgnat/a-strunb__shared.ads
+++ b/gcc/ada/libgnat/a-strunb__shared.ads
@@ -45,6 +45,8 @@  pragma Assertion_Policy (Pre => Ignore);
 
 --  This version is supported on:
 --    - all Alpha platforms
+--    - all AARCH64 platforms
+--    - all ARM platforms
 --    - all ia64 platforms
 --    - all PowerPC platforms
 --    - all SPARC V9 platforms


diff --git a/gcc/ada/libgnat/s-atocou.ads b/gcc/ada/libgnat/s-atocou.ads
--- a/gcc/ada/libgnat/s-atocou.ads
+++ b/gcc/ada/libgnat/s-atocou.ads
@@ -31,6 +31,8 @@ 
 
 --  This package provides atomic counter on platforms where it is supported:
 --    - all Alpha platforms
+--    - all AARCH64 platforms
+--    - all ARM platforms
 --    - all ia64 platforms
 --    - all PowerPC platforms
 --    - all SPARC V9 platforms