Skip to content

Commit 4bf50e0

Browse files
authored
[llvm-dlltool] Use -N for input native def option to avoid conflict with GNU dlltool --no-delete option. (#81847)
1 parent 79213da commit 4bf50e0

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,12 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef<const char *> ArgsArr) {
205205

206206
std::vector<COFFShortExport> Exports, NativeExports;
207207

208-
if (Args.hasArg(OPT_n)) {
208+
if (Args.hasArg(OPT_N)) {
209209
if (!isArm64EC(Machine)) {
210210
llvm::errs() << "native .def file is supported only on arm64ec target\n";
211211
return 1;
212212
}
213-
if (!parseModuleDefinition(Args.getLastArg(OPT_n)->getValue(),
213+
if (!parseModuleDefinition(Args.getLastArg(OPT_N)->getValue(),
214214
IMAGE_FILE_MACHINE_ARM64, AddUnderscores,
215215
NativeExports, OutputFile))
216216
return 1;

llvm/lib/ToolDrivers/llvm-dlltool/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ def D_long : JoinedOrSeparate<["--"], "dllname">, Alias<D>;
1212
def d: JoinedOrSeparate<["-"], "d">, HelpText<"Input .def File">;
1313
def d_long : JoinedOrSeparate<["--"], "input-def">, Alias<d>;
1414

15-
def n: JoinedOrSeparate<["-"], "n">, HelpText<"Input native .def File on ARM64EC">;
16-
def n_long : JoinedOrSeparate<["--"], "input-native-def">, Alias<d>;
15+
def N: JoinedOrSeparate<["-"], "N">, HelpText<"Input native .def File on ARM64EC">;
16+
def N_long : JoinedOrSeparate<["--"], "input-native-def">, Alias<N>;
1717

1818
def k: Flag<["-"], "k">, HelpText<"Kill @n Symbol from export">;
1919
def k_alias: Flag<["--"], "kill-at">, Alias<k>;

llvm/test/tools/llvm-dlltool/arm64ec.test

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ARMAP-NEXT: __imp_aux_func in test.dll
1616
ARMAP-NEXT: __imp_func in test.dll
1717
ARMAP-NEXT: func in test.dll
1818

19-
RUN: llvm-dlltool -m arm64ec -d test.def -n test2.def -l test2.lib
19+
RUN: llvm-dlltool -m arm64ec -d test.def -N test2.def -l test2.lib
2020
RUN: llvm-nm --print-armap test2.lib | FileCheck --check-prefix=ARMAP2 %s
2121

2222
ARMAP2: Archive map
@@ -32,7 +32,10 @@ ARMAP2-NEXT: __imp_aux_func in test.dll
3232
ARMAP2-NEXT: __imp_func in test.dll
3333
ARMAP2-NEXT: func in test.dll
3434

35-
RUN: not llvm-dlltool -m arm64 -d test.def -n test2.def -l test2.lib 2>&1 | FileCheck --check-prefix=ERR %s
35+
RUN: llvm-dlltool -m arm64ec -d test.def --input-native-def test2.def -l test3.lib
36+
RUN: llvm-nm --print-armap test3.lib | FileCheck --check-prefix=ARMAP2 %s
37+
38+
RUN: not llvm-dlltool -m arm64 -d test.def -N test2.def -l test4.lib 2>&1 | FileCheck --check-prefix=ERR %s
3639
ERR: native .def file is supported only on arm64ec target
3740

3841
#--- test.def

0 commit comments

Comments
 (0)