[PATCH] D86512: [LLD][MinGW] Handle allow-multiple-definition flag
Mateusz MikuĊa via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 01:42:02 PDT 2020
mati865 created this revision.
mati865 added a reviewer: mstorsjo.
mati865 added a project: lld.
Herald added subscribers: llvm-commits, dang.
Herald added a project: LLVM.
mati865 requested review of this revision.
Basically copied from ELF driver.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D86512
Files:
lld/MinGW/Driver.cpp
lld/MinGW/Options.td
lld/test/MinGW/driver.test
Index: lld/test/MinGW/driver.test
===================================================================
--- lld/test/MinGW/driver.test
+++ lld/test/MinGW/driver.test
@@ -260,3 +260,11 @@
RUN: ld.lld -### -m i386pe foo.o -no-seh | FileCheck -check-prefix NOSEH %s
RUN: ld.lld -### -m i386pe foo.o --no-seh | FileCheck -check-prefix NOSEH %s
NOSEH: -noseh
+
+RUN: ld.lld -### -m i386pep foo.o --no-allow-multiple-definition --allow-multiple-definition | FileCheck -check-prefix ALLOW_MULTIPLE_DEFINITION %s
+RUN: ld.lld -### -m i386pep foo.o -no-allow-multiple-definition -allow-multiple-definition | FileCheck -check-prefix ALLOW_MULTIPLE_DEFINITION %s
+ALLOW_MULTIPLE_DEFINITION: -force:multiple
+
+RUN: ld.lld -### -m i386pep foo.o --allow-multiple-definition --no-allow-multiple-definition | FileCheck -check-prefix NO_ALLOW_MULTIPLE_DEFINITION %s
+RUN: ld.lld -### -m i386pep foo.o -allow-multiple-definition -no-allow-multiple-definition | FileCheck -check-prefix NO_ALLOW_MULTIPLE_DEFINITION %s
+NO_ALLOW_MULTIPLE_DEFINITION-NOT: -force:multiple
Index: lld/MinGW/Options.td
===================================================================
--- lld/MinGW/Options.td
+++ lld/MinGW/Options.td
@@ -23,6 +23,9 @@
def L: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">,
HelpText<"Add a directory to the library search path">;
+defm allow_multiple_definition: B<"allow-multiple-definition",
+ "Allow multiple definitions",
+ "Do not allow multiple definitions (default)">;
def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">;
def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">;
def disable_auto_import: F<"disable-auto-import">,
Index: lld/MinGW/Driver.cpp
===================================================================
--- lld/MinGW/Driver.cpp
+++ lld/MinGW/Driver.cpp
@@ -313,6 +313,10 @@
else
add("-runtime-pseudo-reloc:no");
+ if (args.hasFlag(OPT_allow_multiple_definition,
+ OPT_no_allow_multiple_definition, false))
+ add("-force:multiple");
+
if (auto *a = args.getLastArg(OPT_icf)) {
StringRef s = a->getValue();
if (s == "all")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86512.287592.patch
Type: text/x-patch
Size: 2151 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200825/6461ac0a/attachment.bin>
More information about the llvm-commits
mailing list