[lld] [llvm] [RISCV] Support RISCV Atomics ABI attributes (PR #84597)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 4 14:14:43 PDT 2024


================
@@ -322,6 +331,49 @@
 #--- atomic_abi_A7.s
 .attribute atomic_abi, 3
 
+
+#      UNKNOWN_UNKNOWN: BuildAttributes {
----------------
ilovepi wrote:

So, we probably need to double check w/ @MaskRay, but I believe we don't emit attributes w/ 0 value in general. I think the following snippet seems to indicate that from a few lines below the call to `mergeAtomics`. I assume that is because the default value of 0 is pretty much 'not used', so it isn't emitted normally, and since UNKOWN is 0, it just falls into that case.

```
size_t size = 5 + merged.vendor.size() + 1 + 5;
  for (auto &attr : merged.intAttr)
    if (attr.second != 0)
      size += getULEB128Size(attr.first) + getULEB128Size(attr.second);
```

I'll update the patch to address the nits, but I'll try to wait for Fangrui to confirm if thats correct about 0 valued attributes before proceeding.

https://github.com/llvm/llvm-project/pull/84597


More information about the llvm-commits mailing list