[Git][ghc/ghc][wip/T22012] rts/RtsSymbols: Add AArch64 outline atomic operations
Ben Gamari (@bgamari)
gitlab at gitlab.haskell.org
Thu Jul 20 02:43:44 UTC 2023
Ben Gamari pushed to branch wip/T22012 at Glasgow Haskell Compiler / GHC
Commits:
1ca2f799 by Ben Gamari at 2023-07-19T22:43:35-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
def main() -> None:
ops = set()
ORDERINGS = [ 'relax', 'acq', 'rel', 'acq_rel', 'sync' ]
for order in ORDERINGS:
for n in [1,2,4,8]:
for op in ['swp', 'ldadd', 'ldclr', 'ldeor', 'ldset']:
ops.add(f'__aarch64_{op}{n}_{order}')
for n in [1,2,4,8,16]:
ops.add(f'__aarch64_cas{n}_{order}')
lines = [ "#define RTS_AARCH64_SYMBOLS" ]
lines += [ f' SymE_NeedsProto({op})' for op in sorted(ops) ]
print(' \\\n'.join(lines))
main()
```
- - - - -
2 changed files:
- + rts/AArch64Symbols.h
- rts/RtsSymbols.c
Changes:
=====================================
rts/AArch64Symbols.h
=====================================
@@ -0,0 +1,126 @@
+#define RTS_AARCH64_SYMBOLS \
+ SymE_HasProto(__aarch64_cas16_acq) \
+ SymE_HasProto(__aarch64_cas16_acq_rel) \
+ SymE_HasProto(__aarch64_cas16_rel) \
+ SymE_HasProto(__aarch64_cas16_relax) \
+ SymE_HasProto(__aarch64_cas16_sync) \
+ SymE_HasProto(__aarch64_cas1_acq) \
+ SymE_HasProto(__aarch64_cas1_acq_rel) \
+ SymE_HasProto(__aarch64_cas1_rel) \
+ SymE_HasProto(__aarch64_cas1_relax) \
+ SymE_HasProto(__aarch64_cas1_sync) \
+ SymE_HasProto(__aarch64_cas2_acq) \
+ SymE_HasProto(__aarch64_cas2_acq_rel) \
+ SymE_HasProto(__aarch64_cas2_rel) \
+ SymE_HasProto(__aarch64_cas2_relax) \
+ SymE_HasProto(__aarch64_cas2_sync) \
+ SymE_HasProto(__aarch64_cas4_acq) \
+ SymE_HasProto(__aarch64_cas4_acq_rel) \
+ SymE_HasProto(__aarch64_cas4_rel) \
+ SymE_HasProto(__aarch64_cas4_relax) \
+ SymE_HasProto(__aarch64_cas4_sync) \
+ SymE_HasProto(__aarch64_cas8_acq) \
+ SymE_HasProto(__aarch64_cas8_acq_rel) \
+ SymE_HasProto(__aarch64_cas8_rel) \
+ SymE_HasProto(__aarch64_cas8_relax) \
+ SymE_HasProto(__aarch64_cas8_sync) \
+ SymE_HasProto(__aarch64_ldadd1_acq) \
+ SymE_HasProto(__aarch64_ldadd1_acq_rel) \
+ SymE_HasProto(__aarch64_ldadd1_rel) \
+ SymE_HasProto(__aarch64_ldadd1_relax) \
+ SymE_HasProto(__aarch64_ldadd1_sync) \
+ SymE_HasProto(__aarch64_ldadd2_acq) \
+ SymE_HasProto(__aarch64_ldadd2_acq_rel) \
+ SymE_HasProto(__aarch64_ldadd2_rel) \
+ SymE_HasProto(__aarch64_ldadd2_relax) \
+ SymE_HasProto(__aarch64_ldadd2_sync) \
+ SymE_HasProto(__aarch64_ldadd4_acq) \
+ SymE_HasProto(__aarch64_ldadd4_acq_rel) \
+ SymE_HasProto(__aarch64_ldadd4_rel) \
+ SymE_HasProto(__aarch64_ldadd4_relax) \
+ SymE_HasProto(__aarch64_ldadd4_sync) \
+ SymE_HasProto(__aarch64_ldadd8_acq) \
+ SymE_HasProto(__aarch64_ldadd8_acq_rel) \
+ SymE_HasProto(__aarch64_ldadd8_rel) \
+ SymE_HasProto(__aarch64_ldadd8_relax) \
+ SymE_HasProto(__aarch64_ldadd8_sync) \
+ SymE_HasProto(__aarch64_ldclr1_acq) \
+ SymE_HasProto(__aarch64_ldclr1_acq_rel) \
+ SymE_HasProto(__aarch64_ldclr1_rel) \
+ SymE_HasProto(__aarch64_ldclr1_relax) \
+ SymE_HasProto(__aarch64_ldclr1_sync) \
+ SymE_HasProto(__aarch64_ldclr2_acq) \
+ SymE_HasProto(__aarch64_ldclr2_acq_rel) \
+ SymE_HasProto(__aarch64_ldclr2_rel) \
+ SymE_HasProto(__aarch64_ldclr2_relax) \
+ SymE_HasProto(__aarch64_ldclr2_sync) \
+ SymE_HasProto(__aarch64_ldclr4_acq) \
+ SymE_HasProto(__aarch64_ldclr4_acq_rel) \
+ SymE_HasProto(__aarch64_ldclr4_rel) \
+ SymE_HasProto(__aarch64_ldclr4_relax) \
+ SymE_HasProto(__aarch64_ldclr4_sync) \
+ SymE_HasProto(__aarch64_ldclr8_acq) \
+ SymE_HasProto(__aarch64_ldclr8_acq_rel) \
+ SymE_HasProto(__aarch64_ldclr8_rel) \
+ SymE_HasProto(__aarch64_ldclr8_relax) \
+ SymE_HasProto(__aarch64_ldclr8_sync) \
+ SymE_HasProto(__aarch64_ldeor1_acq) \
+ SymE_HasProto(__aarch64_ldeor1_acq_rel) \
+ SymE_HasProto(__aarch64_ldeor1_rel) \
+ SymE_HasProto(__aarch64_ldeor1_relax) \
+ SymE_HasProto(__aarch64_ldeor1_sync) \
+ SymE_HasProto(__aarch64_ldeor2_acq) \
+ SymE_HasProto(__aarch64_ldeor2_acq_rel) \
+ SymE_HasProto(__aarch64_ldeor2_rel) \
+ SymE_HasProto(__aarch64_ldeor2_relax) \
+ SymE_HasProto(__aarch64_ldeor2_sync) \
+ SymE_HasProto(__aarch64_ldeor4_acq) \
+ SymE_HasProto(__aarch64_ldeor4_acq_rel) \
+ SymE_HasProto(__aarch64_ldeor4_rel) \
+ SymE_HasProto(__aarch64_ldeor4_relax) \
+ SymE_HasProto(__aarch64_ldeor4_sync) \
+ SymE_HasProto(__aarch64_ldeor8_acq) \
+ SymE_HasProto(__aarch64_ldeor8_acq_rel) \
+ SymE_HasProto(__aarch64_ldeor8_rel) \
+ SymE_HasProto(__aarch64_ldeor8_relax) \
+ SymE_HasProto(__aarch64_ldeor8_sync) \
+ SymE_HasProto(__aarch64_ldset1_acq) \
+ SymE_HasProto(__aarch64_ldset1_acq_rel) \
+ SymE_HasProto(__aarch64_ldset1_rel) \
+ SymE_HasProto(__aarch64_ldset1_relax) \
+ SymE_HasProto(__aarch64_ldset1_sync) \
+ SymE_HasProto(__aarch64_ldset2_acq) \
+ SymE_HasProto(__aarch64_ldset2_acq_rel) \
+ SymE_HasProto(__aarch64_ldset2_rel) \
+ SymE_HasProto(__aarch64_ldset2_relax) \
+ SymE_HasProto(__aarch64_ldset2_sync) \
+ SymE_HasProto(__aarch64_ldset4_acq) \
+ SymE_HasProto(__aarch64_ldset4_acq_rel) \
+ SymE_HasProto(__aarch64_ldset4_rel) \
+ SymE_HasProto(__aarch64_ldset4_relax) \
+ SymE_HasProto(__aarch64_ldset4_sync) \
+ SymE_HasProto(__aarch64_ldset8_acq) \
+ SymE_HasProto(__aarch64_ldset8_acq_rel) \
+ SymE_HasProto(__aarch64_ldset8_rel) \
+ SymE_HasProto(__aarch64_ldset8_relax) \
+ SymE_HasProto(__aarch64_ldset8_sync) \
+ SymE_HasProto(__aarch64_swp1_acq) \
+ SymE_HasProto(__aarch64_swp1_acq_rel) \
+ SymE_HasProto(__aarch64_swp1_rel) \
+ SymE_HasProto(__aarch64_swp1_relax) \
+ SymE_HasProto(__aarch64_swp1_sync) \
+ SymE_HasProto(__aarch64_swp2_acq) \
+ SymE_HasProto(__aarch64_swp2_acq_rel) \
+ SymE_HasProto(__aarch64_swp2_rel) \
+ SymE_HasProto(__aarch64_swp2_relax) \
+ SymE_HasProto(__aarch64_swp2_sync) \
+ SymE_HasProto(__aarch64_swp4_acq) \
+ SymE_HasProto(__aarch64_swp4_acq_rel) \
+ SymE_HasProto(__aarch64_swp4_rel) \
+ SymE_HasProto(__aarch64_swp4_relax) \
+ SymE_HasProto(__aarch64_swp4_sync) \
+ SymE_HasProto(__aarch64_swp8_acq) \
+ SymE_HasProto(__aarch64_swp8_acq_rel) \
+ SymE_HasProto(__aarch64_swp8_rel) \
+ SymE_HasProto(__aarch64_swp8_relax) \
+ SymE_HasProto(__aarch64_swp8_sync)
=====================================
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/1ca2f79977d082d8ce55474b8b6a4af06c39e11a
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1ca2f79977d082d8ce55474b8b6a4af06c39e11a
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/20230719/990e9e69/attachment-0001.html>
More information about the ghc-commits
mailing list