Skip to content

Commit

Permalink
[llvm-dlltool] Use -N for input native def option to avoid conflict w…
Browse files Browse the repository at this point in the history
…ith GNU dlltool --no-delete option. (#81847)
  • Loading branch information
cjacek committed Feb 15, 2024
1 parent 79213da commit 4bf50e0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef<const char *> ArgsArr) {

std::vector<COFFShortExport> Exports, NativeExports;

if (Args.hasArg(OPT_n)) {
if (Args.hasArg(OPT_N)) {
if (!isArm64EC(Machine)) {
llvm::errs() << "native .def file is supported only on arm64ec target\n";
return 1;
}
if (!parseModuleDefinition(Args.getLastArg(OPT_n)->getValue(),
if (!parseModuleDefinition(Args.getLastArg(OPT_N)->getValue(),
IMAGE_FILE_MACHINE_ARM64, AddUnderscores,
NativeExports, OutputFile))
return 1;
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/ToolDrivers/llvm-dlltool/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def D_long : JoinedOrSeparate<["--"], "dllname">, Alias<D>;
def d: JoinedOrSeparate<["-"], "d">, HelpText<"Input .def File">;
def d_long : JoinedOrSeparate<["--"], "input-def">, Alias<d>;

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

def k: Flag<["-"], "k">, HelpText<"Kill @n Symbol from export">;
def k_alias: Flag<["--"], "kill-at">, Alias<k>;
Expand Down
7 changes: 5 additions & 2 deletions llvm/test/tools/llvm-dlltool/arm64ec.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ARMAP-NEXT: __imp_aux_func in test.dll
ARMAP-NEXT: __imp_func in test.dll
ARMAP-NEXT: func in test.dll

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

ARMAP2: Archive map
Expand All @@ -32,7 +32,10 @@ ARMAP2-NEXT: __imp_aux_func in test.dll
ARMAP2-NEXT: __imp_func in test.dll
ARMAP2-NEXT: func in test.dll

RUN: not llvm-dlltool -m arm64 -d test.def -n test2.def -l test2.lib 2>&1 | FileCheck --check-prefix=ERR %s
RUN: llvm-dlltool -m arm64ec -d test.def --input-native-def test2.def -l test3.lib
RUN: llvm-nm --print-armap test3.lib | FileCheck --check-prefix=ARMAP2 %s

RUN: not llvm-dlltool -m arm64 -d test.def -N test2.def -l test4.lib 2>&1 | FileCheck --check-prefix=ERR %s
ERR: native .def file is supported only on arm64ec target

#--- test.def
Expand Down

0 comments on commit 4bf50e0

Please sign in to comment.