Skip to content

Commit db62913

Browse files
committedSep 10, 2018
[MinGW] Hook up the --require-defined option to -include:
Differential Revision: https://reviews.llvm.org/D51840 llvm-svn: 341846
1 parent 7feb3ed commit db62913

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed
 

‎lld/MinGW/Driver.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) {
212212
else
213213
Add("-alternatename:__image_base__=__ImageBase");
214214

215+
for (auto *A : Args.filtered(OPT_require_defined))
216+
Add("-include:" + StringRef(A->getValue()));
217+
215218
std::vector<StringRef> SearchPaths;
216219
for (auto *A : Args.filtered(OPT_L))
217220
SearchPaths.push_back(A->getValue());

‎lld/MinGW/Options.td

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ def strip_debug: F<"strip-debug">,
4040
def whole_archive: F<"whole-archive">,
4141
HelpText<"Include all object files for following archives">;
4242
def verbose: F<"verbose">, HelpText<"Verbose mode">;
43+
def require_defined: S<"require-defined">,
44+
HelpText<"Force symbol to be added to symbol table as an undefined one">;
45+
def require_defined_eq: J<"require-defined=">, Alias<require_defined>;
4346

4447
// LLD specific options
4548
def _HASH_HASH_HASH : Flag<["-"], "###">,

‎lld/test/MinGW/driver.test

+3
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,6 @@ RUN: ld.lld -### foo.o -m i386pep --Map bar.map | FileCheck -check-prefix=MAP %s
145145
RUN: ld.lld -### foo.o -m i386pep -Map=bar.map | FileCheck -check-prefix=MAP %s
146146
RUN: ld.lld -### foo.o -m i386pep --Map=bar.map | FileCheck -check-prefix=MAP %s
147147
MAP: -lldmap:bar.map
148+
149+
RUN: ld.lld -### foo.o -m i386pe -require-defined _foo --require-defined _bar -require-defined=_baz --require-defined=_foo2 | FileCheck -check-prefix=REQUIRE-DEFINED %s
150+
REQUIRE-DEFINED: -include:_foo -include:_bar -include:_baz -include:_foo2

0 commit comments

Comments
 (0)
Please sign in to comment.