[lld] [LLD] [COFF] Rewrite handling of the /debug: option. NFC. (PR #75175)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 13 12:19:03 PST 2023
================
@@ -1647,13 +1607,47 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
if (args.hasArg(OPT_force, OPT_force_multipleres))
config->forceMultipleRes = true;
+ // Don't warn about long section names, such as .debug_info, for mingw (or
+ // when -debug:dwarf is requested, handled below).
+ if (config->mingw)
+ config->warnLongSectionNames = false;
+
+ bool doGC = true;
+
// Handle /debug
- DebugKind debug = parseDebugKind(args);
- if (debug == DebugKind::Full || debug == DebugKind::Dwarf ||
- debug == DebugKind::GHash || debug == DebugKind::NoGHash) {
- config->debug = true;
- config->incremental = true;
- config->includeDwarfChunks = true;
+ bool shouldCreatePDB = false;
+ if (auto *arg = args.getLastArg(OPT_debug, OPT_debug_opt)) {
+ std::string s;
+ if (arg->getOption().getID() == OPT_debug)
+ s = "full";
+ else
+ s = StringRef(arg->getValue()).lower();
+ if (s == "fastlink") {
+ warn("/debug:fastlink unsupported; using /debug:full");
+ s = "full";
+ }
+ if (s == "none") {
----------------
mstorsjo wrote:
But if there's no `/debug:` option at all, then we'd go with the initial value of `doGC` - which should be `true` for that case.
https://github.com/llvm/llvm-project/pull/75175
More information about the llvm-commits
mailing list