diff options
author | Daniel Paoliello <danpao@microsoft.com> | 2024-03-12 14:10:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-12 14:10:49 -0700 |
commit | 1a6ec906fb3781c2fc98979ec37a2a76479b0b08 (patch) | |
tree | 9de33284d5b3f51175eaec5616d05a243faaeb71 /llvm/lib/Object/COFFImportFile.cpp | |
parent | 498b7d2f86b4bceb381e66b093670c7ec4bc6cc4 (diff) | |
download | llvm-1a6ec906fb3781c2fc98979ec37a2a76479b0b08.zip llvm-1a6ec906fb3781c2fc98979ec37a2a76479b0b08.tar.gz llvm-1a6ec906fb3781c2fc98979ec37a2a76479b0b08.tar.bz2 |
[Arm64EC] Copy import descriptors to the EC Map (#84834)
As noted in <https://github.com/llvm/llvm-project/pull/78537>, MSVC
places import descriptors in both the EC and regular map - that PR moved
the descriptors to ONLY the regular map, however this causes linking
errors when linking as Arm64EC:
```
bcryptprimitives.lib(bcryptprimitives.dll) : error LNK2001: unresolved external symbol __IMPORT_DESCRIPTOR_bcryptprimitives (EC Symbol)
```
This change copies import descriptors from the regular map to the EC
map, which fixes this linking error.
Diffstat (limited to 'llvm/lib/Object/COFFImportFile.cpp')
-rw-r--r-- | llvm/lib/Object/COFFImportFile.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Object/COFFImportFile.cpp b/llvm/lib/Object/COFFImportFile.cpp index 376dd12..46c8e70 100644 --- a/llvm/lib/Object/COFFImportFile.cpp +++ b/llvm/lib/Object/COFFImportFile.cpp @@ -108,7 +108,7 @@ template <class T> static void append(std::vector<uint8_t> &B, const T &Data) { } static void writeStringTable(std::vector<uint8_t> &B, - ArrayRef<const std::string> Strings) { + ArrayRef<const std::string_view> Strings) { // The COFF string table consists of a 4-byte value which is the size of the // table, including the length field itself. This value is followed by the // string content itself, which is an array of null-terminated C-style @@ -171,9 +171,6 @@ static Expected<std::string> replace(StringRef S, StringRef From, return (Twine(S.substr(0, Pos)) + To + S.substr(Pos + From.size())).str(); } -static const std::string NullImportDescriptorSymbolName = - "__NULL_IMPORT_DESCRIPTOR"; - namespace { // This class constructs various small object files necessary to support linking // symbols imported from a DLL. The contents are pretty strictly defined and @@ -192,8 +189,9 @@ class ObjectFactory { public: ObjectFactory(StringRef S, MachineTypes M) : NativeMachine(M), ImportName(S), Library(llvm::sys::path::stem(S)), - ImportDescriptorSymbolName(("__IMPORT_DESCRIPTOR_" + Library).str()), - NullThunkSymbolName(("\x7f" + Library + "_NULL_THUNK_DATA").str()) {} + ImportDescriptorSymbolName((ImportDescriptorPrefix + Library).str()), + NullThunkSymbolName( + (NullThunkDataPrefix + Library + NullThunkDataSuffix).str()) {} // Creates an Import Descriptor. This is a small object file which contains a // reference to the terminators and contains the library name (entry) for the |