diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-02-19 05:33:51 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-02-19 05:33:51 +0000 |
commit | 8ac38d7b5d88d12f454a7cda1275bf429813151d (patch) | |
tree | 9efd518ddc82f60a2f7e068482b2c901efdfc0e4 /lib | |
parent | aef05d71bcceb6f913b1749500863bcd3fed43b6 (diff) |
Driver/Darwin: Support -Wl, with -Xarch_. This doesn't work naturally because of
the special way we model "linker input" arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126023 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Driver/ToolChains.cpp | 15 | ||||
-rw-r--r-- | lib/Driver/Tools.cpp | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 236a1549eb..13b8b4609e 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -699,6 +699,7 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args, if (getArchName() != A->getValue(Args, 0)) continue; + Arg *OriginalArg = A; unsigned Index = Args.getBaseArgs().MakeIndex(A->getValue(Args, 1)); unsigned Prev = Index; Arg *XarchArg = Opts.ParseOneArg(Args, Index); @@ -722,6 +723,20 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args, A = XarchArg; DAL->AddSynthesizedArg(A); + + // Linker input arguments require custom handling. The problem is that we + // have already constructed the phase actions, so we can not treat them as + // "input arguments". + if (A->getOption().isLinkerInput()) { + // Convert the argument into individual Zlinker_input_args. + for (unsigned i = 0, e = A->getNumValues(); i != e; ++i) { + DAL->AddSeparateArg(OriginalArg, + Opts.getOption(options::OPT_Zlinker_input), + A->getValue(Args, i)); + + } + continue; + } } // Sob. These is strictly gcc compatible for the time being. Apple diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 5233e2bcf6..8328982ae9 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -91,6 +91,10 @@ static void AddLinkerInputs(const ToolChain &TC, ArgStringList &CmdArgs) { const Driver &D = TC.getDriver(); + // Add extra linker input arguments which are not treated as inputs + // (constructed via -Xarch_). + Args.AddAllArgValues(CmdArgs, options::OPT_Zlinker_input); + for (InputInfoList::const_iterator it = Inputs.begin(), ie = Inputs.end(); it != ie; ++it) { const InputInfo &II = *it; |