[lld] [llvm] [RISCV] Support RISCV Atomics ABI attributes (PR #84597)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 29 13:30:15 PDT 2024
================
@@ -1084,10 +1084,62 @@ static void mergeArch(RISCVISAInfo::OrderedExtensionMap &mergedExts,
}
}
+static void mergeAtomic(DenseMap<unsigned, unsigned>::iterator it,
+ const InputSectionBase *oldSection,
+ const InputSectionBase *newSection, unsigned int oldTag,
+ unsigned int newTag) {
+ using RISCVAttrs::RISCVAtomicAbiTag::AtomicABI;
+ // Same tags stay the same, and UNKNOWN is compatible with anything
+ if (oldTag == newTag || newTag == AtomicABI::UNKNOWN)
+ return;
+
+ switch (oldTag) {
+ case AtomicABI::UNKNOWN:
+ it->getSecond() = newTag;
+ return;
+ case AtomicABI::A6C:
+ switch (newTag) {
+ case AtomicABI::A6S:
+ it->getSecond() = AtomicABI::A6C;
+ return;
+ case AtomicABI::A7:
+ error(toString(oldSection) + " has atomic_abi=" + Twine(oldTag) +
----------------
MaskRay wrote:
This should use `errorOrWarn`.
Sorry that I did not follow up the discussion in time, but I'd appreciate that I had the opportunity to give this comment after the patch was approved by @asb ...
https://github.com/llvm/llvm-project/pull/84597
More information about the llvm-commits
mailing list