[Git][ghc/ghc][wip/T22012] rts/RtsSymbols: Add AArch64 outline atomic operations

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Wed Jul 5 17:54:44 UTC 2023



Ben Gamari pushed to branch wip/T22012 at Glasgow Haskell Compiler / GHC


Commits:
d38c4752 by Ben Gamari at 2023-07-05T13:52:52-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,100 @@
+    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
=====================================
@@ -1055,6 +1055,9 @@ RtsSymbolVal rtsSyms[] = {
       RTS_LIBGCC_SYMBOLS
       RTS_FINI_ARRAY_SYMBOLS
       RTS_LIBFFI_SYMBOLS
+#if defined(linux_HOST_OS) && defined(aarch64_HOST_ARCH)
+#include "AArch64Symbols.h"
+#endif
       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/d38c475224a08d2d75b0a32ffb5acd6f3703d6bc

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d38c475224a08d2d75b0a32ffb5acd6f3703d6bc
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/20230705/77656971/attachment-0001.html>


More information about the ghc-commits mailing list