From 5baa1c76410e2d250a897f92ddc92dbdcd69040c Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Tue, 6 Sep 2016 18:28:49 +0000 Subject: [PATCH] [ELF] Add support for -no-gc-sections flag This flag is supported by both BFD ld and gold and is occasionally used to negate the effect of -gc-sections flag. Differential Revision: https://reviews.llvm.org/D24270 llvm-svn: 280729 --- lld/ELF/Driver.cpp | 2 +- lld/ELF/Options.td | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 40607e3..45c6b1b 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -400,7 +400,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { Config->EnableNewDtags = !Args.hasArg(OPT_disable_new_dtags); Config->ExportDynamic = Args.hasArg(OPT_export_dynamic); Config->FatalWarnings = Args.hasArg(OPT_fatal_warnings); - Config->GcSections = Args.hasArg(OPT_gc_sections); + Config->GcSections = getArg(Args, OPT_gc_sections, OPT_no_gc_sections, false); Config->ICF = Args.hasArg(OPT_icf); Config->NoGnuUnique = Args.hasArg(OPT_no_gnu_unique); Config->NoUndefinedVersion = Args.hasArg(OPT_no_undefined_version); diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td index d37a41a..d8ef1b3 100644 --- a/lld/ELF/Options.td +++ b/lld/ELF/Options.td @@ -106,6 +106,9 @@ def no_as_needed: F<"no-as-needed">, def no_demangle: F<"no-demangle">, HelpText<"Do not demangle symbol names">; +def no_gc_sections: F<"no-gc-sections">, + HelpText<"Disable garbage collection of unused sections">; + def no_gnu_unique: F<"no-gnu-unique">, HelpText<"Disable STB_GNU_UNIQUE symbol binding">; -- 2.7.4