summaryrefslogtreecommitdiff
path: root/lld/MinGW
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2022-07-18 23:43:02 +0300
committerMartin Storsjö <martin@martin.st>2022-08-11 11:59:47 +0300
commitd1da6469f9ea9b078276ee2e098241f0440468be (patch)
tree00b4c1f3c25aa8890d65056c7031d602995b008a /lld/MinGW
parent164067918725d1ee8875e38213b6aee9be13383e (diff)
downloadllvm-d1da6469f9ea9b078276ee2e098241f0440468be.tar.gz
[LLD] [MinGW] Implement the --exclude-symbols option
This adds support for the existing GNU ld command line option, which allows excluding individual symbols from autoexport (when linking a DLL and no symbols are marked explicitly as dllexported). Differential Revision: https://reviews.llvm.org/D130118
Diffstat (limited to 'lld/MinGW')
-rw-r--r--lld/MinGW/Driver.cpp2
-rw-r--r--lld/MinGW/Options.td2
2 files changed, 4 insertions, 0 deletions
diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp
index 5920a5061d9c..37d2439c3925 100644
--- a/lld/MinGW/Driver.cpp
+++ b/lld/MinGW/Driver.cpp
@@ -398,6 +398,8 @@ bool mingw::link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
add("-delayload:" + StringRef(a->getValue()));
for (auto *a : args.filtered(OPT_wrap))
add("-wrap:" + StringRef(a->getValue()));
+ for (auto *a : args.filtered(OPT_exclude_symbols))
+ add("-exclude-symbols:" + StringRef(a->getValue()));
std::vector<StringRef> searchPaths;
for (auto *a : args.filtered(OPT_L)) {
diff --git a/lld/MinGW/Options.td b/lld/MinGW/Options.td
index bfdd4af28800..cc94b93e388a 100644
--- a/lld/MinGW/Options.td
+++ b/lld/MinGW/Options.td
@@ -62,6 +62,8 @@ def enable_stdcall_fixup: F<"enable-stdcall-fixup">,
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">;
+defm exclude_symbols: Eq<"exclude-symbols",
+ "Exclude symbols from automatic export">, MetaVarName<"<symbol[,symbol,...]>">;
def export_all_symbols: F<"export-all-symbols">,
HelpText<"Export all symbols even if a def file or dllexport attributes are used">;
defm fatal_warnings: B<"fatal-warnings",