[llvm] [llvm] annotate interfaces in llvm/MC and llvm/MCA for DLL export (PR #142655)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 3 20:50:10 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-tools-llvm-mca

Author: Andrew Rogers (andrurogerz)

<details>
<summary>Changes</summary>

## Purpose

This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the `llvm/MC` and `llvm/MCA` libraries. These annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build.

## Background

This effort is tracked in #<!-- -->109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307), and documentation for `LLVM_ABI` and related annotations is found in the LLVM repo [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst).  

The bulk of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`.

The following manual adjustments were also applied after running IDS on Linux:
- Add `#include "llvm/Support/Compiler.h"` to files where it was not auto-added by IDS due to no pre-existing block of include statements.
- Explicitly make classes non-copyable where needed to due IDS adding LLVM_ABI at the class level

## Validation

Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations:

- Windows with MSVC
- Windows with Clang
- Linux with GCC
- Linux with Clang
- Darwin with Clang

---

Patch is 128.21 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/142655.diff


56 Files Affected:

- (modified) llvm/include/llvm/MC/MCAsmBackend.h (+2-1) 
- (modified) llvm/include/llvm/MC/MCAsmInfo.h (+6-1) 
- (modified) llvm/include/llvm/MC/MCAsmMacro.h (+5-4) 
- (modified) llvm/include/llvm/MC/MCAssembler.h (+27-23) 
- (modified) llvm/include/llvm/MC/MCCodeEmitter.h (+3-1) 
- (modified) llvm/include/llvm/MC/MCContext.h (+108-94) 
- (modified) llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h (+3-2) 
- (modified) llvm/include/llvm/MC/MCDisassembler/MCRelocationInfo.h (+3-1) 
- (modified) llvm/include/llvm/MC/MCDisassembler/MCSymbolizer.h (+2-1) 
- (modified) llvm/include/llvm/MC/MCDwarf.h (+44-36) 
- (modified) llvm/include/llvm/MC/MCExpr.h (+32-26) 
- (modified) llvm/include/llvm/MC/MCFragment.h (+5-4) 
- (modified) llvm/include/llvm/MC/MCInst.h (+16-11) 
- (modified) llvm/include/llvm/MC/MCInstPrinter.h (+6-5) 
- (modified) llvm/include/llvm/MC/MCInstrAnalysis.h (+2-1) 
- (modified) llvm/include/llvm/MC/MCInstrDesc.h (+8-5) 
- (modified) llvm/include/llvm/MC/MCInstrInfo.h (+3-2) 
- (modified) llvm/include/llvm/MC/MCLinkerOptimizationHint.h (+4-3) 
- (modified) llvm/include/llvm/MC/MCMachObjectWriter.h (+4-3) 
- (modified) llvm/include/llvm/MC/MCObjectFileInfo.h (+2-1) 
- (modified) llvm/include/llvm/MC/MCObjectWriter.h (+4-3) 
- (modified) llvm/include/llvm/MC/MCParser/AsmLexer.h (+8-6) 
- (modified) llvm/include/llvm/MC/MCParser/MCAsmParser.h (+8-6) 
- (modified) llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h (+2-1) 
- (modified) llvm/include/llvm/MC/MCParser/MCParsedAsmOperand.h (+2-1) 
- (modified) llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h (+2-1) 
- (modified) llvm/include/llvm/MC/MCPseudoProbe.h (+27-24) 
- (modified) llvm/include/llvm/MC/MCRegisterInfo.h (+2-1) 
- (modified) llvm/include/llvm/MC/MCSchedule.h (+20-16) 
- (modified) llvm/include/llvm/MC/MCSection.h (+2-1) 
- (modified) llvm/include/llvm/MC/MCSectionMachO.h (+2-1) 
- (modified) llvm/include/llvm/MC/MCStreamer.h (+5-4) 
- (modified) llvm/include/llvm/MC/MCSubtargetInfo.h (+2-1) 
- (modified) llvm/include/llvm/MC/MCSymbol.h (+7-5) 
- (modified) llvm/include/llvm/MC/MCTargetOptions.h (+4-3) 
- (modified) llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h (+23-22) 
- (modified) llvm/include/llvm/MC/MCWinEH.h (+2-1) 
- (modified) llvm/include/llvm/MC/StringTableBuilder.h (+10-9) 
- (modified) llvm/include/llvm/MC/TargetRegistry.h (+72-71) 
- (modified) llvm/include/llvm/MCA/CodeEmitter.h (+2-1) 
- (modified) llvm/include/llvm/MCA/Context.h (+7-6) 
- (modified) llvm/include/llvm/MCA/CustomBehaviour.h (+3-2) 
- (modified) llvm/include/llvm/MCA/HWEventListener.h (+2-1) 
- (modified) llvm/include/llvm/MCA/HardwareUnits/HardwareUnit.h (+3-1) 
- (modified) llvm/include/llvm/MCA/HardwareUnits/LSUnit.h (+3-2) 
- (modified) llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h (+24-20) 
- (modified) llvm/include/llvm/MCA/HardwareUnits/Scheduler.h (+17-17) 
- (modified) llvm/include/llvm/MCA/IncrementalSourceMgr.h (+6-1) 
- (modified) llvm/include/llvm/MCA/InstrBuilder.h (+6-5) 
- (modified) llvm/include/llvm/MCA/Instruction.h (+17-16) 
- (modified) llvm/include/llvm/MCA/Pipeline.h (+4-3) 
- (modified) llvm/include/llvm/MCA/Stages/EntryStage.h (+2-1) 
- (modified) llvm/include/llvm/MCA/Stages/InstructionTables.h (+2-1) 
- (modified) llvm/include/llvm/MCA/Stages/Stage.h (+3-2) 
- (modified) llvm/include/llvm/MCA/Support.h (+8-6) 
- (modified) llvm/include/llvm/MCA/View.h (+2-1) 


``````````diff
diff --git a/llvm/include/llvm/MC/MCAsmBackend.h b/llvm/include/llvm/MC/MCAsmBackend.h
index f6d776b839fe5..e49e786a10f58 100644
--- a/llvm/include/llvm/MC/MCAsmBackend.h
+++ b/llvm/include/llvm/MC/MCAsmBackend.h
@@ -12,6 +12,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/MC/MCDirectives.h"
 #include "llvm/MC/MCFixup.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Endian.h"
 #include <cstdint>
 
@@ -39,7 +40,7 @@ class StringRef;
 class raw_ostream;
 
 /// Generic interface to target specific assembler backends.
-class MCAsmBackend {
+class LLVM_ABI MCAsmBackend {
 protected: // Can only create subclasses.
   MCAsmBackend(llvm::endianness Endian) : Endian(Endian) {}
 
diff --git a/llvm/include/llvm/MC/MCAsmInfo.h b/llvm/include/llvm/MC/MCAsmInfo.h
index 3a31957f2f6be..4eb50344d6384 100644
--- a/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/llvm/include/llvm/MC/MCAsmInfo.h
@@ -20,6 +20,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCDirectives.h"
 #include "llvm/MC/MCTargetOptions.h"
+#include "llvm/Support/Compiler.h"
 #include <vector>
 
 namespace llvm {
@@ -55,7 +56,7 @@ enum LCOMMType { NoAlignment, ByteAlignment, Log2Alignment };
 
 /// This class is intended to be used as a base class for asm
 /// properties and features specific to the target.
-class MCAsmInfo {
+class LLVM_ABI MCAsmInfo {
 public:
   /// Assembly character literal syntax types.
   enum AsmCharLiteralSyntax {
@@ -427,6 +428,10 @@ class MCAsmInfo {
   explicit MCAsmInfo();
   virtual ~MCAsmInfo();
 
+  // Explicitly non-copyable.
+  MCAsmInfo(MCAsmInfo const &) = delete;
+  MCAsmInfo &operator=(MCAsmInfo const &) = delete;
+
   /// Get the code pointer size in bytes.
   unsigned getCodePointerSize() const { return CodePointerSize; }
 
diff --git a/llvm/include/llvm/MC/MCAsmMacro.h b/llvm/include/llvm/MC/MCAsmMacro.h
index c0c895fa94e64..ce50fb6418845 100644
--- a/llvm/include/llvm/MC/MCAsmMacro.h
+++ b/llvm/include/llvm/MC/MCAsmMacro.h
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/SMLoc.h"
 #include <vector>
@@ -74,9 +75,9 @@ class AsmToken {
   bool is(TokenKind K) const { return Kind == K; }
   bool isNot(TokenKind K) const { return Kind != K; }
 
-  SMLoc getLoc() const;
-  SMLoc getEndLoc() const;
-  SMRange getLocRange() const;
+  LLVM_ABI SMLoc getLoc() const;
+  LLVM_ABI SMLoc getEndLoc() const;
+  LLVM_ABI SMRange getLocRange() const;
 
   /// Get the contents of a string token (without quotes).
   StringRef getStringContents() const {
@@ -115,7 +116,7 @@ class AsmToken {
     return IntVal;
   }
 
-  void dump(raw_ostream &OS) const;
+  LLVM_ABI void dump(raw_ostream &OS) const;
 };
 
 struct MCAsmMacroParameter {
diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h
index 988677193d6d9..5e009090311c4 100644
--- a/llvm/include/llvm/MC/MCAssembler.h
+++ b/llvm/include/llvm/MC/MCAssembler.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/MC/MCDwarf.h"
 #include "llvm/MC/MCSymbol.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/SMLoc.h"
 #include <algorithm>
 #include <cassert>
@@ -135,46 +136,48 @@ class MCAssembler {
   // concrete and require clients to pass in a target like object. The other
   // option is to make this abstract, and have targets provide concrete
   // implementations as we do with AsmParser.
-  MCAssembler(MCContext &Context, std::unique_ptr<MCAsmBackend> Backend,
-              std::unique_ptr<MCCodeEmitter> Emitter,
-              std::unique_ptr<MCObjectWriter> Writer);
+  LLVM_ABI MCAssembler(MCContext &Context,
+                       std::unique_ptr<MCAsmBackend> Backend,
+                       std::unique_ptr<MCCodeEmitter> Emitter,
+                       std::unique_ptr<MCObjectWriter> Writer);
   MCAssembler(const MCAssembler &) = delete;
   MCAssembler &operator=(const MCAssembler &) = delete;
 
   /// Compute the effective fragment size.
-  uint64_t computeFragmentSize(const MCFragment &F) const;
+  LLVM_ABI uint64_t computeFragmentSize(const MCFragment &F) const;
 
-  void layoutBundle(MCFragment *Prev, MCFragment *F) const;
+  LLVM_ABI void layoutBundle(MCFragment *Prev, MCFragment *F) const;
 
   // Get the offset of the given fragment inside its containing section.
   uint64_t getFragmentOffset(const MCFragment &F) const { return F.Offset; }
 
-  uint64_t getSectionAddressSize(const MCSection &Sec) const;
-  uint64_t getSectionFileSize(const MCSection &Sec) const;
+  LLVM_ABI uint64_t getSectionAddressSize(const MCSection &Sec) const;
+  LLVM_ABI uint64_t getSectionFileSize(const MCSection &Sec) const;
 
   // Get the offset of the given symbol, as computed in the current
   // layout.
   // \return True on success.
-  bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const;
+  LLVM_ABI bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const;
 
   // Variant that reports a fatal error if the offset is not computable.
-  uint64_t getSymbolOffset(const MCSymbol &S) const;
+  LLVM_ABI uint64_t getSymbolOffset(const MCSymbol &S) const;
 
   // If this symbol is equivalent to A + Constant, return A.
-  const MCSymbol *getBaseSymbol(const MCSymbol &Symbol) const;
+  LLVM_ABI const MCSymbol *getBaseSymbol(const MCSymbol &Symbol) const;
 
   /// Emit the section contents to \p OS.
-  void writeSectionData(raw_ostream &OS, const MCSection *Section) const;
+  LLVM_ABI void writeSectionData(raw_ostream &OS,
+                                 const MCSection *Section) const;
 
   /// Check whether a given symbol has been flagged with .thumb_func.
-  bool isThumbFunc(const MCSymbol *Func) const;
+  LLVM_ABI bool isThumbFunc(const MCSymbol *Func) const;
 
   /// Flag a function symbol as the target of a .thumb_func directive.
   void setIsThumbFunc(const MCSymbol *Func) { ThumbFuncs.insert(Func); }
 
   /// Reuse an assembler instance
   ///
-  void reset();
+  LLVM_ABI void reset();
 
   MCContext &getContext() const { return Context; }
 
@@ -193,10 +196,10 @@ class MCAssembler {
   /// Finish - Do final processing and write the object to the output stream.
   /// \p Writer is used for custom object writer (as the MCJIT does),
   /// if not specified it is automatically created from backend.
-  void Finish();
+  LLVM_ABI void Finish();
 
   // Layout all section and prepare them for emission.
-  void layout();
+  LLVM_ABI void layout();
 
   bool hasLayout() const { return HasLayout; }
   bool hasFinalLayout() const { return HasFinalLayout; }
@@ -223,21 +226,22 @@ class MCAssembler {
     return make_pointee_range(Symbols);
   }
 
-  bool registerSection(MCSection &Section);
-  bool registerSymbol(const MCSymbol &Symbol);
+  LLVM_ABI bool registerSection(MCSection &Section);
+  LLVM_ABI bool registerSymbol(const MCSymbol &Symbol);
 
   /// Write the necessary bundle padding to \p OS.
   /// Expects a fragment \p F containing instructions and its size \p FSize.
-  void writeFragmentPadding(raw_ostream &OS, const MCEncodedFragment &F,
-                            uint64_t FSize) const;
+  LLVM_ABI void writeFragmentPadding(raw_ostream &OS,
+                                     const MCEncodedFragment &F,
+                                     uint64_t FSize) const;
 
-  void reportError(SMLoc L, const Twine &Msg) const;
+  LLVM_ABI void reportError(SMLoc L, const Twine &Msg) const;
   // Record pending errors during layout iteration, as they may go away once the
   // layout is finalized.
-  void recordError(SMLoc L, const Twine &Msg) const;
-  void flushPendingErrors() const;
+  LLVM_ABI void recordError(SMLoc L, const Twine &Msg) const;
+  LLVM_ABI void flushPendingErrors() const;
 
-  void dump() const;
+  LLVM_ABI void dump() const;
 };
 
 } // end namespace llvm
diff --git a/llvm/include/llvm/MC/MCCodeEmitter.h b/llvm/include/llvm/MC/MCCodeEmitter.h
index ceb16c9b4da78..1c454c3795c2c 100644
--- a/llvm/include/llvm/MC/MCCodeEmitter.h
+++ b/llvm/include/llvm/MC/MCCodeEmitter.h
@@ -9,6 +9,8 @@
 #ifndef LLVM_MC_MCCODEEMITTER_H
 #define LLVM_MC_MCCODEEMITTER_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 
 class MCFixup;
@@ -18,7 +20,7 @@ class raw_ostream;
 template<typename T> class SmallVectorImpl;
 
 /// MCCodeEmitter - Generic instruction encoding interface.
-class MCCodeEmitter {
+class LLVM_ABI MCCodeEmitter {
 protected: // Can only create subclasses.
   MCCodeEmitter();
 
diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h
index a2a53427be986..76a750db3fa17 100644
--- a/llvm/include/llvm/MC/MCContext.h
+++ b/llvm/include/llvm/MC/MCContext.h
@@ -375,15 +375,16 @@ class MCContext {
   DenseSet<StringRef> ELFSeenGenericMergeableSections;
 
 public:
-  explicit MCContext(const Triple &TheTriple, const MCAsmInfo *MAI,
-                     const MCRegisterInfo *MRI, const MCSubtargetInfo *MSTI,
-                     const SourceMgr *Mgr = nullptr,
-                     MCTargetOptions const *TargetOpts = nullptr,
-                     bool DoAutoReset = true,
-                     StringRef Swift5ReflSegmentName = {});
+  LLVM_ABI explicit MCContext(const Triple &TheTriple, const MCAsmInfo *MAI,
+                              const MCRegisterInfo *MRI,
+                              const MCSubtargetInfo *MSTI,
+                              const SourceMgr *Mgr = nullptr,
+                              MCTargetOptions const *TargetOpts = nullptr,
+                              bool DoAutoReset = true,
+                              StringRef Swift5ReflSegmentName = {});
   MCContext(const MCContext &) = delete;
   MCContext &operator=(const MCContext &) = delete;
-  ~MCContext();
+  LLVM_ABI ~MCContext();
 
   Environment getObjectFileType() const { return Env; }
 
@@ -393,7 +394,7 @@ class MCContext {
   const Triple &getTargetTriple() const { return TT; }
   const SourceMgr *getSourceManager() const { return SrcMgr; }
 
-  void initInlineSourceManager();
+  LLVM_ABI void initInlineSourceManager();
   SourceMgr *getInlineSourceManager() { return InlineSrcMgr.get(); }
   std::vector<const MDNode *> &getLocInfos() { return LocInfos; }
   void setDiagnosticHandler(DiagHandlerTy DiagHandler) {
@@ -412,7 +413,7 @@ class MCContext {
 
   const MCTargetOptions *getTargetOptions() const { return TargetOptions; }
 
-  CodeViewContext &getCVContext();
+  LLVM_ABI CodeViewContext &getCVContext();
 
   void setUseNamesOnTempLabels(bool Value) { UseNamesOnTempLabels = Value; }
 
@@ -421,14 +422,14 @@ class MCContext {
 
   /// reset - return object to right after construction state to prepare
   /// to process a new module
-  void reset();
+  LLVM_ABI void reset();
 
   /// @}
 
   /// \name McInst Management
 
   /// Create and return a new MC instruction.
-  MCInst *createMCInst();
+  LLVM_ABI MCInst *createMCInst();
 
   template <typename F, typename... Args> F *allocFragment(Args &&...args) {
     return new (FragmentAllocator.Allocate(sizeof(F), alignof(F)))
@@ -441,64 +442,69 @@ class MCContext {
   /// Create a new linker temporary symbol with the specified prefix (Name) or
   /// "tmp". This creates a "l"-prefixed symbol for Mach-O and is identical to
   /// createNamedTempSymbol for other object file formats.
-  MCSymbol *createLinkerPrivateTempSymbol();
-  MCSymbol *createLinkerPrivateSymbol(const Twine &Name);
+  LLVM_ABI MCSymbol *createLinkerPrivateTempSymbol();
+  LLVM_ABI MCSymbol *createLinkerPrivateSymbol(const Twine &Name);
 
   /// Create a temporary symbol with a unique name. The name will be omitted
   /// in the symbol table if UseNamesOnTempLabels is false (default except
   /// MCAsmStreamer). The overload without Name uses an unspecified name.
-  MCSymbol *createTempSymbol();
-  MCSymbol *createTempSymbol(const Twine &Name, bool AlwaysAddSuffix = true);
+  LLVM_ABI MCSymbol *createTempSymbol();
+  LLVM_ABI MCSymbol *createTempSymbol(const Twine &Name,
+                                      bool AlwaysAddSuffix = true);
 
   /// Create a temporary symbol with a unique name whose name cannot be
   /// omitted in the symbol table. This is rarely used.
-  MCSymbol *createNamedTempSymbol();
-  MCSymbol *createNamedTempSymbol(const Twine &Name);
+  LLVM_ABI MCSymbol *createNamedTempSymbol();
+  LLVM_ABI MCSymbol *createNamedTempSymbol(const Twine &Name);
 
   /// Get or create a symbol for a basic block. For non-always-emit symbols,
   /// this behaves like createTempSymbol, except that it uses the
   /// PrivateLabelPrefix instead of the PrivateGlobalPrefix. When AlwaysEmit is
   /// true, behaves like getOrCreateSymbol, prefixed with PrivateLabelPrefix.
-  MCSymbol *createBlockSymbol(const Twine &Name, bool AlwaysEmit = false);
+  LLVM_ABI MCSymbol *createBlockSymbol(const Twine &Name,
+                                       bool AlwaysEmit = false);
 
   /// Create a local, non-temporary symbol like an ELF mapping symbol. Calling
   /// the function with the same name will generate new, unique instances.
-  MCSymbol *createLocalSymbol(StringRef Name);
+  LLVM_ABI MCSymbol *createLocalSymbol(StringRef Name);
 
   /// Create the definition of a directional local symbol for numbered label
   /// (used for "1:" definitions).
-  MCSymbol *createDirectionalLocalSymbol(unsigned LocalLabelVal);
+  LLVM_ABI MCSymbol *createDirectionalLocalSymbol(unsigned LocalLabelVal);
 
   /// Create and return a directional local symbol for numbered label (used
   /// for "1b" or 1f" references).
-  MCSymbol *getDirectionalLocalSymbol(unsigned LocalLabelVal, bool Before);
+  LLVM_ABI MCSymbol *getDirectionalLocalSymbol(unsigned LocalLabelVal,
+                                               bool Before);
 
   /// Lookup the symbol inside with the specified \p Name.  If it exists,
   /// return it.  If not, create a forward reference and return it.
   ///
   /// \param Name - The symbol name, which must be unique across all symbols.
-  MCSymbol *getOrCreateSymbol(const Twine &Name);
+  LLVM_ABI MCSymbol *getOrCreateSymbol(const Twine &Name);
 
   /// Gets a symbol that will be defined to the final stack offset of a local
   /// variable after codegen.
   ///
   /// \param Idx - The index of a local variable passed to \@llvm.localescape.
-  MCSymbol *getOrCreateFrameAllocSymbol(const Twine &FuncName, unsigned Idx);
+  LLVM_ABI MCSymbol *getOrCreateFrameAllocSymbol(const Twine &FuncName,
+                                                 unsigned Idx);
 
-  MCSymbol *getOrCreateParentFrameOffsetSymbol(const Twine &FuncName);
+  LLVM_ABI MCSymbol *getOrCreateParentFrameOffsetSymbol(const Twine &FuncName);
 
-  MCSymbol *getOrCreateLSDASymbol(const Twine &FuncName);
+  LLVM_ABI MCSymbol *getOrCreateLSDASymbol(const Twine &FuncName);
 
   /// Get the symbol for \p Name, or null.
-  MCSymbol *lookupSymbol(const Twine &Name) const;
+  LLVM_ABI MCSymbol *lookupSymbol(const Twine &Name) const;
 
   /// Clone a symbol for the .set directive, replacing it in the symbol table.
   /// Existing references to the original symbol remain unchanged, and the
   /// original symbol is not emitted to the symbol table.
-  MCSymbol *cloneSymbol(MCSymbol &Sym);
+  LLVM_ABI MCSymbol *cloneSymbol(MCSymbol &Sym);
 
   /// Set value for a symbol.
-  void setSymbolValue(MCStreamer &Streamer, const Twine &Sym, uint64_t Val);
+  LLVM_ABI void setSymbolValue(MCStreamer &Streamer, const Twine &Sym,
+                               uint64_t Val);
 
   /// getSymbols - Get a reference for the symbol table for clients that
   /// want to, for example, iterate over all symbols. 'const' because we
@@ -514,11 +520,11 @@ class MCContext {
 
   /// registerInlineAsmLabel - Records that the name is a label referenced in
   /// inline assembly.
-  void registerInlineAsmLabel(MCSymbol *Sym);
+  LLVM_ABI void registerInlineAsmLabel(MCSymbol *Sym);
 
   /// Allocates and returns a new `WasmSignature` instance (with empty parameter
   /// and return type lists).
-  wasm::WasmSignature *createWasmSignature();
+  LLVM_ABI wasm::WasmSignature *createWasmSignature();
 
   /// @}
 
@@ -527,10 +533,10 @@ class MCContext {
 
   /// Return the MCSection for the specified mach-o section.  This requires
   /// the operands to be valid.
-  MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
-                                  unsigned TypeAndAttributes,
-                                  unsigned Reserved2, SectionKind K,
-                                  const char *BeginSymName = nullptr);
+  LLVM_ABI MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
+                                           unsigned TypeAndAttributes,
+                                           unsigned Reserved2, SectionKind K,
+                                           const char *BeginSymName = nullptr);
 
   MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
                                   unsigned TypeAndAttributes, SectionKind K,
@@ -557,85 +563,93 @@ class MCContext {
                          MCSection::NonUniqueID, nullptr);
   }
 
-  MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
-                              unsigned Flags, unsigned EntrySize,
-                              const Twine &Group, bool IsComdat,
-                              unsigned UniqueID,
-                              const MCSymbolELF *LinkedToSym);
+  LLVM_ABI MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
+                                       unsigned Flags, unsigned EntrySize,
+                                       const Twine &Group, bool IsComdat,
+                                       unsigned UniqueID,
+                                       const MCSymbolELF *LinkedToSym);
 
-  MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
-                              unsigned Flags, unsigned EntrySize,
-                              const MCSymbolELF *Group, bool IsComdat,
-                              unsigned UniqueID,
-                              const MCSymbolELF *LinkedToSym);
+  LLVM_ABI MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
+                                       unsigned Flags, unsigned EntrySize,
+                                       const MCSymbolELF *Group, bool IsComdat,
+                                       unsigned UniqueID,
+                                       const MCSymbolELF *LinkedToSym);
 
   /// Get a section with the provided group identifier. This section is
   /// named by concatenating \p Prefix with '.' then \p Suffix. The \p Type
   /// describes the type of the section and \p Flags are used to further
   /// configure this named section.
-  MCSectionELF *getELFNamedSection(const Twine &Prefix, const Twine &Suffix,
-                                   unsigned Type, unsigned Flags,
-                                   unsigned EntrySize = 0);
+  LLVM_ABI MCSectionELF *getELFNamedSection(const Twine &Prefix,
+                                            const Twine &Suffix, unsigned Type,
+                                            unsigned Flags,
+                                            unsigned EntrySize = 0);
 
-  MCSectionELF *createELFRelSection(const Twine &Name, unsigned Type,
-                                    unsigned Flags, unsigned EntrySize,
-                                    const MCSymbolELF *Group,
-                                    const MCSectionELF *RelInfoSection);
+  LLVM_ABI MCSectionELF *
+  createELFRelSection(const Twine &Name, unsigned Type, unsigned Flags,
+                      unsigned EntrySize, const MCSymbolELF *Group,
+                      const MCSectionELF *RelInfoSection);
 
-  MCSectionELF *createELFGroupSection(const MCSymbolELF *Group, bool IsComdat);
+  LLVM_ABI MCSectionELF *createELFGroupSection(const MCSymbolELF *Group,
+                                               bool IsComdat);
 
-  void recordELFMergeableSectionInfo(StringRef SectionName, unsigned Flags,
-                                     unsigned UniqueID, unsigned EntrySize);
+  LLVM_ABI void recordELFMergeableSectionInfo(StringRef SectionName,
+                                              unsigned Flags, unsigned UniqueID,
+                                              unsigned EntrySize);
 
-  bool isELFImplicitMergeableSectionNamePrefix(StringRef Name);
+  LLVM_ABI bool isELFImplicitMergeableSectionNamePrefix(StringRef Name);
 
-  bool is...
[truncated]

``````````

</details>


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


More information about the llvm-commits mailing list