[all-commits] [llvm/llvm-project] 80e18b: [llvm-dlltool] Remove the i386 underscore prefix f...
Martin Storsjö via All-commits
all-commits at lists.llvm.org
Tue Jul 16 13:10:50 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 80e18b93c5abfcbf296b6e2b45cea1ee77633f1e
https://github.com/llvm/llvm-project/commit/80e18b93c5abfcbf296b6e2b45cea1ee77633f1e
Author: Martin Storsjö <martin at martin.st>
Date: 2024-07-16 (Tue, 16 Jul 2024)
Changed paths:
M llvm/include/llvm/Object/COFFImportFile.h
M llvm/lib/Object/COFFImportFile.cpp
M llvm/lib/Object/COFFModuleDefinition.cpp
M llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
Log Message:
-----------
[llvm-dlltool] Remove the i386 underscore prefix from COFFImportFile::ImportName. NFC. (#98226)
On i386, regular C level symbols are given an underscore prefix
in the symbols on the object file level. However, the exported
names from DLLs usually don't have this leading underscore.
When specified in a def file like "symbol == dllname", the "dllname"
is the name of the exported symbol from the DLL, which will be
linked against from an object file symbol named "_symbol"
(on i386).
The mechanism where one symbol is redirected to another one in
an import library is implemented with weak aliases. In that case,
we need to have the object file symbol level name for the target
of the import, as we make one object file symbol point at another
one. Therefore, we added an underscore to the ImportName field.
(This mechanism, with weak aliases, only works as long as the
target also is exported as is, in that form - this issue is
dealt with in a later commit.)
For clarity, for potentially handling the import renaming in
other ways, store the ImportName field unprefixed, containing
the actual name to import from the DLL.
When creating the aliases, add the prefix as needed. This requires
passing an extra AddUnderscores parameter to the writeImportLibrary
function; this is a temporary measure, until alias creation is
reworked in a later commit.
This doesn't preserve the corner case of checking !isDecorated()
before adding the prefix. This corner case isn't tested by any
of our existing tests, and only would trigger for
fastcall/vectorcall/MS C++ functions - while these kinds of
renames primarily are used in mingw-w64-crt import libraries
(which primarily handle cdecl and stdcall functions).
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list