Skip to content

Commit a3913a1

Browse files
authored
[llvm-dlltool] Respect the DATA flag when creating aliases (#98225)
1 parent e4163c0 commit a3913a1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

llvm/lib/Object/COFFImportFile.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,9 @@ Error writeImportLibrary(StringRef ImportName, StringRef Path,
691691
}
692692

693693
if (!E.ImportName.empty() && Name != E.ImportName) {
694-
Members.push_back(OF.createWeakExternal(E.ImportName, Name, false, M));
694+
if (ImportType == IMPORT_CODE)
695+
Members.push_back(
696+
OF.createWeakExternal(E.ImportName, Name, false, M));
695697
Members.push_back(OF.createWeakExternal(E.ImportName, Name, true, M));
696698
continue;
697699
}

llvm/test/tools/llvm-dlltool/coff-weak-exports.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
LIBRARY test.dll
77
EXPORTS
88
TestFunction==AltTestFunction
9+
TestData DATA == AltTestData
910
; When creating an import library, the DLL internal function name of
1011
; the implementation of a function isn't visible at all.
1112
ImpLibName = Implementation
@@ -20,6 +21,9 @@ ImpLibName3 = kernel32.Sleep
2021
; CHECK-NEXT: W TestFunction
2122
; CHECK: U __imp_AltTestFunction
2223
; CHECK-NEXT: W __imp_TestFunction
24+
; CHECK-NOT: W TestData
25+
; CHECK: U __imp_AltTestData
26+
; CHECK-NEXT: W __imp_TestData
2327
; CHECK: T ImpLibName
2428
; CHECK-NEXT: T __imp_ImpLibName
2529
; CHECK: U AltTestFunction2

0 commit comments

Comments
 (0)