[PATCH] D98156: [clang/mac] Accept -why_load and make -whyload an alias for it

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 7 14:00:05 PST 2021


thakis created this revision.
thakis added a reviewer: hans.
Herald added subscribers: jansvoboda11, dang.
thakis requested review of this revision.

>From `man ld`:

  -why_load   Log why each object file in a static library is loaded.
              That is, what symbol was needed.
              Also called -whyload for compatibility.

So `-why_load` is the spelling preferred by the linker and `-whyload` and old
compatibility setting. clang should accept the preferred form, and map both
forms to the preferred form.


https://reviews.llvm.org/D98156

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/Darwin.cpp


Index: clang/lib/Driver/ToolChains/Darwin.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -417,7 +417,7 @@
   Args.AddAllArgs(CmdArgs, options::OPT_sectalign);
   Args.AddAllArgs(CmdArgs, options::OPT_sectobjectsymbols);
   Args.AddAllArgs(CmdArgs, options::OPT_segcreate);
-  Args.AddLastArg(CmdArgs, options::OPT_whyload);
+  Args.AddLastArg(CmdArgs, options::OPT_why_load);
   Args.AddLastArg(CmdArgs, options::OPT_whatsloaded);
   Args.AddAllArgs(CmdArgs, options::OPT_dylinker__install__name);
   Args.AddLastArg(CmdArgs, options::OPT_dylinker);
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -3700,7 +3700,8 @@
 def weak__library : Separate<["-"], "weak_library">, Flags<[LinkerInput]>;
 def weak__reference__mismatches : Separate<["-"], "weak_reference_mismatches">;
 def whatsloaded : Flag<["-"], "whatsloaded">;
-def whyload : Flag<["-"], "whyload">;
+def why_load : Flag<["-"], "why_load">;
+def whyload : Flag<["-"], "whyload">, Alias<why_load>;
 def w : Flag<["-"], "w">, HelpText<"Suppress all warnings">, Flags<[CC1Option]>,
   MarshallingInfoFlag<DiagnosticOpts<"IgnoreWarnings">>;
 def x : JoinedOrSeparate<["-"], "x">, Flags<[NoXarchOption,CC1Option]>,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98156.328906.patch
Type: text/x-patch
Size: 1436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210307/ee1517b9/attachment-0001.bin>


More information about the cfe-commits mailing list