Skip to content

[llvm-dlltool] Respect the DATA flag when creating aliases #98225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion llvm/lib/Object/COFFImportFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,9 @@ Error writeImportLibrary(StringRef ImportName, StringRef Path,
}

if (!E.ImportName.empty() && Name != E.ImportName) {
Members.push_back(OF.createWeakExternal(E.ImportName, Name, false, M));
if (ImportType == IMPORT_CODE)
Members.push_back(
OF.createWeakExternal(E.ImportName, Name, false, M));
Members.push_back(OF.createWeakExternal(E.ImportName, Name, true, M));
continue;
}
Expand Down
4 changes: 4 additions & 0 deletions llvm/test/tools/llvm-dlltool/coff-weak-exports.def
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
LIBRARY test.dll
EXPORTS
TestFunction==AltTestFunction
TestData DATA == AltTestData
; When creating an import library, the DLL internal function name of
; the implementation of a function isn't visible at all.
ImpLibName = Implementation
Expand All @@ -20,6 +21,9 @@ ImpLibName3 = kernel32.Sleep
; CHECK-NEXT: W TestFunction
; CHECK: U __imp_AltTestFunction
; CHECK-NEXT: W __imp_TestFunction
; CHECK-NOT: W TestData
; CHECK: U __imp_AltTestData
; CHECK-NEXT: W __imp_TestData
; CHECK: T ImpLibName
; CHECK-NEXT: T __imp_ImpLibName
; CHECK: U AltTestFunction2
Expand Down
Loading