aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/BinaryFormat/Dwarf.cpp
diff options
context:
space:
mode:
authorAndrew Rogers <andrurogerz@gmail.com>2025-06-17 17:21:40 -0700
committerGitHub <noreply@github.com>2025-06-17 17:21:40 -0700
commitabbdd1670d8b12dd72ec353b14e256619ff4694b (patch)
treef699bf7ec06d2a330fd0d803f5ee23f9f124a16b /llvm/lib/BinaryFormat/Dwarf.cpp
parent64155a32297f4884875783664ff13bec9ab376f5 (diff)
downloadllvm-abbdd1670d8b12dd72ec353b14e256619ff4694b.zip
llvm-abbdd1670d8b12dd72ec353b14e256619ff4694b.tar.gz
llvm-abbdd1670d8b12dd72ec353b14e256619ff4694b.tar.bz2
[llvm] minor fixes for clang-cl Windows DLL build (#144386)
## Purpose This patch makes a minor changes to LLVM and Clang so that LLVM can be built as a Windows DLL with `clang-cl`. These changes were not required for building a Windows DLL with MSVC. ## Background The Windows DLL 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). ## Overview Specific changes made in this patch: - Remove `constexpr` fields that reference DLL exported symbols. These symbols cannot be resolved at compile time when building a Windows DLL using `clang-cl`, so they cannot be `constexpr`. Instead, they are made `const` and initialized in the implementation file rather than at declaration in the header. - Annotate symbols now defined out-of-line with `LLVM_ABI` so they are exported when building as a shared library. - Explicitly add default copy assignment operator for `ELFFile` to resolve a compiler warning. ## 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
Diffstat (limited to 'llvm/lib/BinaryFormat/Dwarf.cpp')
-rw-r--r--llvm/lib/BinaryFormat/Dwarf.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/BinaryFormat/Dwarf.cpp b/llvm/lib/BinaryFormat/Dwarf.cpp
index b9b10a5..0d17dc1 100644
--- a/llvm/lib/BinaryFormat/Dwarf.cpp
+++ b/llvm/lib/BinaryFormat/Dwarf.cpp
@@ -911,6 +911,18 @@ StringRef llvm::dwarf::RLEString(unsigned RLE) {
}
}
+StringRef (*const llvm::dwarf::EnumTraits<Tag>::StringFn)(unsigned) = TagString;
+StringRef (*const llvm::dwarf::EnumTraits<Attribute>::StringFn)(unsigned) =
+ AttributeString;
+StringRef (*const llvm::dwarf::EnumTraits<Form>::StringFn)(unsigned) =
+ FormEncodingString;
+StringRef (*const llvm::dwarf::EnumTraits<LocationAtom>::StringFn)(unsigned) =
+ OperationEncodingString;
+StringRef (*const llvm::dwarf::EnumTraits<LineNumberOps>::StringFn)(unsigned) =
+ LNStandardString;
+StringRef (*const llvm::dwarf::EnumTraits<Index>::StringFn)(unsigned) =
+ IndexString;
+
constexpr char llvm::dwarf::EnumTraits<Attribute>::Type[];
constexpr char llvm::dwarf::EnumTraits<Form>::Type[];
constexpr char llvm::dwarf::EnumTraits<Index>::Type[];