[llvm-branch-commits] [RISCV][lld] Support merging RISC-V Atomics ABI attributes (PR #97347)

Paul Kirth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jul 1 20:15:08 PDT 2024


================
@@ -1084,10 +1084,76 @@ static void mergeArch(RISCVISAUtils::OrderedExtensionMap &mergedExts,
   }
 }
 
+static void mergeAtomic(DenseMap<unsigned, unsigned>::iterator it,
+                        const InputSectionBase *oldSection,
+                        const InputSectionBase *newSection,
+                        RISCVAttrs::RISCVAtomicAbiTag oldTag,
+                        RISCVAttrs::RISCVAtomicAbiTag newTag) {
+  using RISCVAttrs::RISCVAtomicAbiTag;
+  // Same tags stay the same, and UNKNOWN is compatible with anything
+  if (oldTag == newTag || newTag == RISCVAtomicAbiTag::UNKNOWN)
+    return;
+
+  auto reportAbiError = [&]() {
+    errorOrWarn("atomic abi mismatch for " + oldSection->name + "\n>>> " +
+                toString(oldSection) +
+                ": atomic_abi=" + Twine(static_cast<unsigned>(oldTag)) +
+                "\n>>> " + toString(newSection) +
+                ": atomic_abi=" + Twine(static_cast<unsigned>(newTag)));
+  };
+
+  switch (static_cast<RISCVAtomicAbiTag>(oldTag)) {
----------------
ilovepi wrote:

yes. Looks like I missed one. Thanks.

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


More information about the llvm-branch-commits mailing list