[PATCH] D69767: [LLD][MinGW] Support --allow-multiple-definition
John Ericson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 3 09:04:37 PST 2019
Ericson2314 created this revision.
Herald added subscribers: llvm-commits, mstorsjo.
Herald added a project: LLVM.
We want the Clang CrossWindows toolchain to work with ld.lld and ld.bfd
alike, and it uses this, so we need to support this.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D69767
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
@@ -40,6 +40,14 @@
RUN: ld.lld -### foo.o -m i386pep -o bar.exe | FileCheck -check-prefix=OUT %s
OUT: -out:bar.exe
+RUN: ld.lld -### foo.o -m i386pep --allow-multiple-definitions | FileCheck -check-prefix=FORCE_MULTIPLE %s
+RUN: ld.lld -### foo.o -m i386pep --no-allow-multiple-definitions --allow-multiple-definitions | FileCheck -check-prefix=FORCE_MULTIPLE %s
+FORCE_MULTIPLE: -force:multiple
+
+RUN: ld.lld -### foo.o -m i386pep --no-allow-multiple-definitions | FileCheck -check-prefix=NO_FORCE_MULTIPLE %s
+RUN: ld.lld -### foo.o -m i386pep --allow-multiple-definitions --no-allow-multiple-definitions | FileCheck -check-prefix=NO_FORCE_MULTIPLE %s
+NO_FORCE_MULTIPLE-NOT: -force:multiple
+
RUN: ld.lld -### foo.o -m i386pep --out-implib bar | FileCheck -check-prefix=IMPLIB %s
RUN: ld.lld -### foo.o -m i386pep --out-implib=bar | FileCheck -check-prefix=IMPLIB %s
RUN: ld.lld -### foo.o -m i386pep -out-implib bar | FileCheck -check-prefix=IMPLIB %s
Index: lld/MinGW/Options.td
===================================================================
--- lld/MinGW/Options.td
+++ lld/MinGW/Options.td
@@ -20,7 +20,13 @@
HelpText<"Add a directory to the library search path">;
def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">;
def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">;
+
+defm allow_multiple_definition: B<"allow-multiple-definition",
+ "Allow multiple definitions",
+ "Do not allow multiple definitions (default)">;
+
def dynamicbase: F<"dynamicbase">, HelpText<"Enable ASLR">;
+
defm entry: Eq<"entry", "Name of entry point symbol">, MetaVarName<"<entry>">;
def exclude_all_symbols: F<"exclude-all-symbols">,
HelpText<"Don't automatically export any symbols">;
Index: lld/MinGW/Driver.cpp
===================================================================
--- lld/MinGW/Driver.cpp
+++ lld/MinGW/Driver.cpp
@@ -232,6 +232,8 @@
add("-subsystem:" + StringRef(a->getValue()));
}
+ if (args.hasFlag(OPT_allow_multiple_definition, OPT_no_allow_multiple_definition, false))
+ add("-force:multiple");
if (auto *a = args.getLastArg(OPT_out_implib))
add("-implib:" + StringRef(a->getValue()));
if (auto *a = args.getLastArg(OPT_stack))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69767.227619.patch
Type: text/x-patch
Size: 2402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191103/158e106b/attachment.bin>
More information about the llvm-commits
mailing list