[Git][ghc/ghc][wip/T22012] rts/RtsSymbols: Add AArch64 outline atomic operations
Ben Gamari (@bgamari)
gitlab at gitlab.haskell.org
Thu Jul 6 19:26:14 UTC 2023
Ben Gamari pushed to branch wip/T22012 at Glasgow Haskell Compiler / GHC
Commits:
9d471794 by Ben Gamari at 2023-07-06T15:26:05-04:00
rts/RtsSymbols: Add AArch64 outline atomic operations
Fixes #22012 by adding the symbols described in
https://github.com/llvm/llvm-project/blob/main/llvm/docs/Atomics.rst#libcalls-atomic.
Ultimately this would be better addressed by #22011, but this is a first
step in the right direction and fixes the immediate symptom.
Generated via:
```python
ops = []
ORDERINGS = [ 'relax', 'acq', 'rel', 'acq_rel' ]
for order in ORDERINGS:
for n in [1,2,4,8]:
for op in ['swp', 'ldadd', 'ldclr', 'ldeor', 'ldset']:
ops.append(f'__aarch64_{op}{n}_{order}')
for m in [1,2,4,8,16]:
ops.append(f'__aarch64_cas{n}_{order}')
print('\n'.join(f' SymE_NeedsProto({op}),' for op in sorted(ops)))
```
- - - - -
2 changed files:
- + rts/AArch64Symbols.h
- rts/RtsSymbols.c
Changes:
=====================================
rts/AArch64Symbols.h
=====================================
@@ -0,0 +1,101 @@
+#define RTS_AARCH64_SYMBOLS \
+ SymE_NeedsProto(__aarch64_cas8_acq),
+ SymE_NeedsProto(__aarch64_cas8_acq),
+ SymE_NeedsProto(__aarch64_cas8_acq),
+ SymE_NeedsProto(__aarch64_cas8_acq),
+ SymE_NeedsProto(__aarch64_cas8_acq),
+ SymE_NeedsProto(__aarch64_cas8_acq_rel),
+ SymE_NeedsProto(__aarch64_cas8_acq_rel),
+ SymE_NeedsProto(__aarch64_cas8_acq_rel),
+ SymE_NeedsProto(__aarch64_cas8_acq_rel),
+ SymE_NeedsProto(__aarch64_cas8_acq_rel),
+ SymE_NeedsProto(__aarch64_cas8_rel),
+ SymE_NeedsProto(__aarch64_cas8_rel),
+ SymE_NeedsProto(__aarch64_cas8_rel),
+ SymE_NeedsProto(__aarch64_cas8_rel),
+ SymE_NeedsProto(__aarch64_cas8_rel),
+ SymE_NeedsProto(__aarch64_cas8_relax),
+ SymE_NeedsProto(__aarch64_cas8_relax),
+ SymE_NeedsProto(__aarch64_cas8_relax),
+ SymE_NeedsProto(__aarch64_cas8_relax),
+ SymE_NeedsProto(__aarch64_cas8_relax),
+ SymE_NeedsProto(__aarch64_ldadd1_acq),
+ SymE_NeedsProto(__aarch64_ldadd1_acq_rel),
+ SymE_NeedsProto(__aarch64_ldadd1_rel),
+ SymE_NeedsProto(__aarch64_ldadd1_relax),
+ SymE_NeedsProto(__aarch64_ldadd2_acq),
+ SymE_NeedsProto(__aarch64_ldadd2_acq_rel),
+ SymE_NeedsProto(__aarch64_ldadd2_rel),
+ SymE_NeedsProto(__aarch64_ldadd2_relax),
+ SymE_NeedsProto(__aarch64_ldadd4_acq),
+ SymE_NeedsProto(__aarch64_ldadd4_acq_rel),
+ SymE_NeedsProto(__aarch64_ldadd4_rel),
+ SymE_NeedsProto(__aarch64_ldadd4_relax),
+ SymE_NeedsProto(__aarch64_ldadd8_acq),
+ SymE_NeedsProto(__aarch64_ldadd8_acq_rel),
+ SymE_NeedsProto(__aarch64_ldadd8_rel),
+ SymE_NeedsProto(__aarch64_ldadd8_relax),
+ SymE_NeedsProto(__aarch64_ldclr1_acq),
+ SymE_NeedsProto(__aarch64_ldclr1_acq_rel),
+ SymE_NeedsProto(__aarch64_ldclr1_rel),
+ SymE_NeedsProto(__aarch64_ldclr1_relax),
+ SymE_NeedsProto(__aarch64_ldclr2_acq),
+ SymE_NeedsProto(__aarch64_ldclr2_acq_rel),
+ SymE_NeedsProto(__aarch64_ldclr2_rel),
+ SymE_NeedsProto(__aarch64_ldclr2_relax),
+ SymE_NeedsProto(__aarch64_ldclr4_acq),
+ SymE_NeedsProto(__aarch64_ldclr4_acq_rel),
+ SymE_NeedsProto(__aarch64_ldclr4_rel),
+ SymE_NeedsProto(__aarch64_ldclr4_relax),
+ SymE_NeedsProto(__aarch64_ldclr8_acq),
+ SymE_NeedsProto(__aarch64_ldclr8_acq_rel),
+ SymE_NeedsProto(__aarch64_ldclr8_rel),
+ SymE_NeedsProto(__aarch64_ldclr8_relax),
+ SymE_NeedsProto(__aarch64_ldeor1_acq),
+ SymE_NeedsProto(__aarch64_ldeor1_acq_rel),
+ SymE_NeedsProto(__aarch64_ldeor1_rel),
+ SymE_NeedsProto(__aarch64_ldeor1_relax),
+ SymE_NeedsProto(__aarch64_ldeor2_acq),
+ SymE_NeedsProto(__aarch64_ldeor2_acq_rel),
+ SymE_NeedsProto(__aarch64_ldeor2_rel),
+ SymE_NeedsProto(__aarch64_ldeor2_relax),
+ SymE_NeedsProto(__aarch64_ldeor4_acq),
+ SymE_NeedsProto(__aarch64_ldeor4_acq_rel),
+ SymE_NeedsProto(__aarch64_ldeor4_rel),
+ SymE_NeedsProto(__aarch64_ldeor4_relax),
+ SymE_NeedsProto(__aarch64_ldeor8_acq),
+ SymE_NeedsProto(__aarch64_ldeor8_acq_rel),
+ SymE_NeedsProto(__aarch64_ldeor8_rel),
+ SymE_NeedsProto(__aarch64_ldeor8_relax),
+ SymE_NeedsProto(__aarch64_ldset1_acq),
+ SymE_NeedsProto(__aarch64_ldset1_acq_rel),
+ SymE_NeedsProto(__aarch64_ldset1_rel),
+ SymE_NeedsProto(__aarch64_ldset1_relax),
+ SymE_NeedsProto(__aarch64_ldset2_acq),
+ SymE_NeedsProto(__aarch64_ldset2_acq_rel),
+ SymE_NeedsProto(__aarch64_ldset2_rel),
+ SymE_NeedsProto(__aarch64_ldset2_relax),
+ SymE_NeedsProto(__aarch64_ldset4_acq),
+ SymE_NeedsProto(__aarch64_ldset4_acq_rel),
+ SymE_NeedsProto(__aarch64_ldset4_rel),
+ SymE_NeedsProto(__aarch64_ldset4_relax),
+ SymE_NeedsProto(__aarch64_ldset8_acq),
+ SymE_NeedsProto(__aarch64_ldset8_acq_rel),
+ SymE_NeedsProto(__aarch64_ldset8_rel),
+ SymE_NeedsProto(__aarch64_ldset8_relax),
+ SymE_NeedsProto(__aarch64_swp1_acq),
+ SymE_NeedsProto(__aarch64_swp1_acq_rel),
+ SymE_NeedsProto(__aarch64_swp1_rel),
+ SymE_NeedsProto(__aarch64_swp1_relax),
+ SymE_NeedsProto(__aarch64_swp2_acq),
+ SymE_NeedsProto(__aarch64_swp2_acq_rel),
+ SymE_NeedsProto(__aarch64_swp2_rel),
+ SymE_NeedsProto(__aarch64_swp2_relax),
+ SymE_NeedsProto(__aarch64_swp4_acq),
+ SymE_NeedsProto(__aarch64_swp4_acq_rel),
+ SymE_NeedsProto(__aarch64_swp4_rel),
+ SymE_NeedsProto(__aarch64_swp4_relax),
+ SymE_NeedsProto(__aarch64_swp8_acq),
+ SymE_NeedsProto(__aarch64_swp8_acq_rel),
+ SymE_NeedsProto(__aarch64_swp8_rel),
+ SymE_NeedsProto(__aarch64_swp8_relax),
=====================================
rts/RtsSymbols.c
=====================================
@@ -967,6 +967,13 @@ extern char **environ;
#define RTS_LIBGCC_SYMBOLS
#endif
+// Symbols defined by libgcc/compiler-rt for AArch64's outline atomics.
+#if defined(linux_HOST_OS) && defined(aarch64_HOST_ARCH)
+#include "AArch64Symbols.h"
+#else
+#define RTS_AARCH64_SYMBOLS
+#endif
+
// Symbols defined by libc
#define RTS_LIBC_SYMBOLS \
SymI_HasProto_redirect(atexit, atexit, STRENGTH_STRONG, CODE_TYPE_CODE) /* See Note [Strong symbols] */ \
@@ -1014,6 +1021,7 @@ RTS_LIBC_SYMBOLS
RTS_LIBGCC_SYMBOLS
RTS_FINI_ARRAY_SYMBOLS
RTS_LIBFFI_SYMBOLS
+RTS_AARCH64_SYMBOLS
#undef SymI_NeedsProto
#undef SymI_NeedsDataProto
@@ -1055,6 +1063,7 @@ RtsSymbolVal rtsSyms[] = {
RTS_LIBGCC_SYMBOLS
RTS_FINI_ARRAY_SYMBOLS
RTS_LIBFFI_SYMBOLS
+ RTS_AARCH64_SYMBOLS
SymI_HasDataProto(nonmoving_write_barrier_enabled)
#if defined(darwin_HOST_OS) && defined(i386_HOST_ARCH)
// dyld stub code contains references to this,
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9d4717944ad5650db136037cadf91bbe2640dd2b
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9d4717944ad5650db136037cadf91bbe2640dd2b
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230706/98342c0e/attachment-0001.html>
More information about the ghc-commits
mailing list