[llvm-branch-commits] [llvm] 2f640ad - Remove support for EXPORTAS in def files to maintain ABI compatibility for COFFShortExport
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Mar 16 18:31:17 PDT 2024
Author: Daniel Paoliello
Date: 2024-03-16T15:55:54-07:00
New Revision: 2f640ad26d176a70c5e7a77c92a899e525e366d9
URL: https://github.com/llvm/llvm-project/commit/2f640ad26d176a70c5e7a77c92a899e525e366d9
DIFF: https://github.com/llvm/llvm-project/commit/2f640ad26d176a70c5e7a77c92a899e525e366d9.diff
LOG: Remove support for EXPORTAS in def files to maintain ABI compatibility for COFFShortExport
Added:
Modified:
llvm/include/llvm/Object/COFFImportFile.h
llvm/lib/Object/COFFImportFile.cpp
llvm/lib/Object/COFFModuleDefinition.cpp
llvm/test/tools/llvm-lib/arm64ec-implib.test
Removed:
llvm/test/tools/llvm-lib/exportas.test
################################################################################
diff --git a/llvm/include/llvm/Object/COFFImportFile.h b/llvm/include/llvm/Object/COFFImportFile.h
index c79ff18d3616ed..8358197309f000 100644
--- a/llvm/include/llvm/Object/COFFImportFile.h
+++ b/llvm/include/llvm/Object/COFFImportFile.h
@@ -120,10 +120,6 @@ struct COFFShortExport {
/// file, this is "baz" in "EXPORTS\nfoo = bar == baz".
std::string AliasTarget;
- /// Specifies EXPORTAS name. In a .def file, this is "bar" in
- /// "EXPORTS\nfoo EXPORTAS bar".
- std::string ExportAs;
-
uint16_t Ordinal = 0;
bool Noname = false;
bool Data = false;
diff --git a/llvm/lib/Object/COFFImportFile.cpp b/llvm/lib/Object/COFFImportFile.cpp
index 99a42d8c4e06a5..d3b5cf2d9f7b52 100644
--- a/llvm/lib/Object/COFFImportFile.cpp
+++ b/llvm/lib/Object/COFFImportFile.cpp
@@ -675,9 +675,6 @@ Error writeImportLibrary(StringRef ImportName, StringRef Path,
std::string ExportName;
if (E.Noname) {
NameType = IMPORT_ORDINAL;
- } else if (!E.ExportAs.empty()) {
- NameType = IMPORT_NAME_EXPORTAS;
- ExportName = E.ExportAs;
} else {
NameType = getNameType(SymbolName, E.Name, Machine, MinGW);
}
diff --git a/llvm/lib/Object/COFFModuleDefinition.cpp b/llvm/lib/Object/COFFModuleDefinition.cpp
index f60dd49793685f..648f01f823d007 100644
--- a/llvm/lib/Object/COFFModuleDefinition.cpp
+++ b/llvm/lib/Object/COFFModuleDefinition.cpp
@@ -39,7 +39,6 @@ enum Kind {
KwConstant,
KwData,
KwExports,
- KwExportAs,
KwHeapsize,
KwLibrary,
KwName,
@@ -119,7 +118,6 @@ class Lexer {
.Case("CONSTANT", KwConstant)
.Case("DATA", KwData)
.Case("EXPORTS", KwExports)
- .Case("EXPORTAS", KwExportAs)
.Case("HEAPSIZE", KwHeapsize)
.Case("LIBRARY", KwLibrary)
.Case("NAME", KwName)
@@ -288,16 +286,7 @@ class Parser {
E.AliasTarget = std::string("_").append(E.AliasTarget);
continue;
}
- // EXPORTAS must be at the end of export definition
- if (Tok.K == KwExportAs) {
- read();
- if (Tok.K == Eof)
- return createError(
- "unexpected end of file, EXPORTAS identifier expected");
- E.ExportAs = std::string(Tok.Value);
- } else {
- unget();
- }
+ unget();
Info.Exports.push_back(E);
return Error::success();
}
diff --git a/llvm/test/tools/llvm-lib/arm64ec-implib.test b/llvm/test/tools/llvm-lib/arm64ec-implib.test
index 52ac486da9e292..ebc1b166ee4ea6 100644
--- a/llvm/test/tools/llvm-lib/arm64ec-implib.test
+++ b/llvm/test/tools/llvm-lib/arm64ec-implib.test
@@ -100,89 +100,6 @@ Creating a new lib containing the existing lib:
RUN: llvm-lib -machine:arm64ec test.lib -out:test2.lib
RUN: llvm-nm --print-armap test2.lib | FileCheck -check-prefix=ARMAP %s
-
-RUN: llvm-lib -machine:arm64ec -def:exportas.def -out:exportas.lib
-RUN: llvm-nm --print-armap exportas.lib | FileCheck -check-prefix=EXPAS-ARMAP %s
-RUN: llvm-readobj exportas.lib | FileCheck -check-prefix=EXPAS-READOBJ %s
-
-EXPAS-ARMAP: Archive EC map
-EXPAS-ARMAP-NEXT: #func1 in test.dll
-EXPAS-ARMAP-NEXT: #func2 in test.dll
-EXPAS-ARMAP-NEXT: #func3 in test.dll
-EXPAS-ARMAP-NEXT: #func4 in test.dll
-EXPAS-ARMAP-NEXT: __IMPORT_DESCRIPTOR_test in test.dll
-EXPAS-ARMAP-NEXT: __NULL_IMPORT_DESCRIPTOR in test.dll
-EXPAS-ARMAP-NEXT: __imp_aux_func1 in test.dll
-EXPAS-ARMAP-NEXT: __imp_aux_func2 in test.dll
-EXPAS-ARMAP-NEXT: __imp_aux_func3 in test.dll
-EXPAS-ARMAP-NEXT: __imp_aux_func4 in test.dll
-EXPAS-ARMAP-NEXT: __imp_data1 in test.dll
-EXPAS-ARMAP-NEXT: __imp_data2 in test.dll
-EXPAS-ARMAP-NEXT: __imp_func1 in test.dll
-EXPAS-ARMAP-NEXT: __imp_func2 in test.dll
-EXPAS-ARMAP-NEXT: __imp_func3 in test.dll
-EXPAS-ARMAP-NEXT: __imp_func4 in test.dll
-EXPAS-ARMAP-NEXT: func1 in test.dll
-EXPAS-ARMAP-NEXT: func2 in test.dll
-EXPAS-ARMAP-NEXT: func3 in test.dll
-EXPAS-ARMAP-NEXT: func4 in test.dll
-EXPAS-ARMAP-NEXT: test_NULL_THUNK_DATA in test.dll
-
-EXPAS-READOBJ: File: test.dll
-EXPAS-READOBJ-NEXT: Format: COFF-import-file-ARM64EC
-EXPAS-READOBJ-NEXT: Type: code
-EXPAS-READOBJ-NEXT: Name type: export as
-EXPAS-READOBJ-NEXT: Export name: func1
-EXPAS-READOBJ-NEXT: Symbol: __imp_func1
-EXPAS-READOBJ-NEXT: Symbol: func1
-EXPAS-READOBJ-NEXT: Symbol: __imp_aux_func1
-EXPAS-READOBJ-NEXT: Symbol: #func1
-EXPAS-READOBJ-EMPTY:
-EXPAS-READOBJ-NEXT: File: test.dll
-EXPAS-READOBJ-NEXT: Format: COFF-import-file-ARM64EC
-EXPAS-READOBJ-NEXT: Type: code
-EXPAS-READOBJ-NEXT: Name type: export as
-EXPAS-READOBJ-NEXT: Export name: func2
-EXPAS-READOBJ-NEXT: Symbol: __imp_func2
-EXPAS-READOBJ-NEXT: Symbol: func2
-EXPAS-READOBJ-NEXT: Symbol: __imp_aux_func2
-EXPAS-READOBJ-NEXT: Symbol: #func2
-EXPAS-READOBJ-EMPTY:
-EXPAS-READOBJ-NEXT: File: test.dll
-EXPAS-READOBJ-NEXT: Format: COFF-import-file-ARM64EC
-EXPAS-READOBJ-NEXT: Type: code
-EXPAS-READOBJ-NEXT: Name type: export as
-EXPAS-READOBJ-NEXT: Export name: #func3
-EXPAS-READOBJ-NEXT: Symbol: __imp_func3
-EXPAS-READOBJ-NEXT: Symbol: func3
-EXPAS-READOBJ-NEXT: Symbol: __imp_aux_func3
-EXPAS-READOBJ-NEXT: Symbol: #func3
-EXPAS-READOBJ-EMPTY:
-EXPAS-READOBJ-NEXT: File: test.dll
-EXPAS-READOBJ-NEXT: Format: COFF-import-file-ARM64EC
-EXPAS-READOBJ-NEXT: Type: code
-EXPAS-READOBJ-NEXT: Name type: export as
-EXPAS-READOBJ-NEXT: Export name: #func4
-EXPAS-READOBJ-NEXT: Symbol: __imp_func4
-EXPAS-READOBJ-NEXT: Symbol: func4
-EXPAS-READOBJ-NEXT: Symbol: __imp_aux_func4
-EXPAS-READOBJ-NEXT: Symbol: #func4
-EXPAS-READOBJ-EMPTY:
-EXPAS-READOBJ-NEXT: File: test.dll
-EXPAS-READOBJ-NEXT: Format: COFF-import-file-ARM64EC
-EXPAS-READOBJ-NEXT: Type: data
-EXPAS-READOBJ-NEXT: Name type: export as
-EXPAS-READOBJ-NEXT: Export name: #data1
-EXPAS-READOBJ-NEXT: Symbol: __imp_data1
-EXPAS-READOBJ-EMPTY:
-EXPAS-READOBJ-NEXT: File: test.dll
-EXPAS-READOBJ-NEXT: Format: COFF-import-file-ARM64EC
-EXPAS-READOBJ-NEXT: Type: data
-EXPAS-READOBJ-NEXT: Name type: export as
-EXPAS-READOBJ-NEXT: Export name: data2
-EXPAS-READOBJ-NEXT: Symbol: __imp_data2
-
-
#--- test.def
LIBRARY test.dll
EXPORTS
@@ -191,13 +108,3 @@ EXPORTS
?test_cpp_func@@YAHPEAX at Z
expname=impname
dataexp DATA
-
-#--- exportas.def
-LIBRARY test.dll
-EXPORTS
- #func1 EXPORTAS func1
- func2 EXPORTAS func2
- func3 EXPORTAS #func3
- #func4 EXPORTAS #func4
- data1 DATA EXPORTAS #data1
- #data2 DATA EXPORTAS data2
diff --git a/llvm/test/tools/llvm-lib/exportas.test b/llvm/test/tools/llvm-lib/exportas.test
deleted file mode 100644
index f6e845ca174664..00000000000000
--- a/llvm/test/tools/llvm-lib/exportas.test
+++ /dev/null
@@ -1,94 +0,0 @@
-Test EXPORTAS in importlibs.
-
-RUN: split-file %s %t.dir && cd %t.dir
-RUN: llvm-lib -machine:amd64 -def:test.def -out:test.lib
-
-RUN: llvm-nm --print-armap test.lib | FileCheck --check-prefix=ARMAP %s
-
-ARMAP: Archive map
-ARMAP-NEXT: __IMPORT_DESCRIPTOR_test in test.dll
-ARMAP-NEXT: __NULL_IMPORT_DESCRIPTOR in test.dll
-ARMAP-NEXT: __imp_func in test.dll
-ARMAP-NEXT: __imp_func2 in test.dll
-ARMAP-NEXT: __imp_func3 in test.dll
-ARMAP-NEXT: __imp_mydata in test.dll
-ARMAP-NEXT: func in test.dll
-ARMAP-NEXT: func2 in test.dll
-ARMAP-NEXT: func3 in test.dll
-ARMAP-NEXT: test_NULL_THUNK_DATA in test.dll
-
-RUN: llvm-readobj test.lib | FileCheck --check-prefix=READOBJ %s
-
-READOBJ: File: test.lib(test.dll)
-READOBJ-NEXT: Format: COFF-x86-64
-READOBJ-NEXT: Arch: x86_64
-READOBJ-NEXT: AddressSize: 64bit
-READOBJ-EMPTY:
-READOBJ-NEXT: File: test.lib(test.dll)
-READOBJ-NEXT: Format: COFF-x86-64
-READOBJ-NEXT: Arch: x86_64
-READOBJ-NEXT: AddressSize: 64bit
-READOBJ-EMPTY:
-READOBJ-NEXT: File: test.lib(test.dll)
-READOBJ-NEXT: Format: COFF-x86-64
-READOBJ-NEXT: Arch: x86_64
-READOBJ-NEXT: AddressSize: 64bit
-READOBJ-EMPTY:
-READOBJ-NEXT: File: test.dll
-READOBJ-NEXT: Format: COFF-import-file-x86-64
-READOBJ-NEXT: Type: code
-READOBJ-NEXT: Name type: export as
-READOBJ-NEXT: Export name: expfunc
-READOBJ-NEXT: Symbol: __imp_func
-READOBJ-NEXT: Symbol: func
-READOBJ-EMPTY:
-READOBJ-NEXT: File: test.dll
-READOBJ-NEXT: Format: COFF-import-file-x86-64
-READOBJ-NEXT: Type: data
-READOBJ-NEXT: Name type: export as
-READOBJ-NEXT: Export name: expdata
-READOBJ-NEXT: Symbol: __imp_mydata
-READOBJ-EMPTY:
-READOBJ-NEXT: File: test.dll
-READOBJ-NEXT: Format: COFF-import-file-x86-64
-READOBJ-NEXT: Type: code
-READOBJ-NEXT: Name type: export as
-READOBJ-NEXT: Export name: expfunc2
-READOBJ-NEXT: Symbol: __imp_func2
-READOBJ-NEXT: Symbol: func2
-READOBJ-EMPTY:
-READOBJ-NEXT: File: test.dll
-READOBJ-NEXT: Format: COFF-import-file-x86-64
-READOBJ-NEXT: Type: code
-READOBJ-NEXT: Name type: export as
-READOBJ-NEXT: Export name: expfunc3
-READOBJ-NEXT: Symbol: __imp_func3
-READOBJ-NEXT: Symbol: func3
-
-
-EXPORTAS must be at the end of entry declaration.
-RUN: not llvm-lib -machine:amd64 -def:test2.def -out:test2.lib 2>&1 \
-RUN: | FileCheck --check-prefix=ERROR %s
-RUN: not llvm-lib -machine:amd64 -def:test3.def -out:test3.lib 2>&1 \
-RUN: | FileCheck --check-prefix=ERROR %s
-ERROR: Invalid data was encountered while parsing the file
-
-
-#--- test.def
-LIBRARY test.dll
-EXPORTS
- func EXPORTAS expfunc
- mydata DATA EXPORTAS expdata
- func2 = myfunc2 EXPORTAS expfunc2
- func3 = otherdll.otherfunc3 EXPORTAS expfunc3
-
-#--- test2.def
-LIBRARY test.dll
-EXPORTS
- func EXPORTAS expfunc
- mydata EXPORTAS expdata DATA
-
-#--- test3.def
-LIBRARY test.dll
-EXPORTS
- mydata EXPORTAS
More information about the llvm-branch-commits
mailing list