From fb29d250128b404baf921f29b5ab9345a29761a0 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Sun, 8 Dec 2013 13:54:58 +0000 Subject: [PATCH] Extend assembler handling for NetBSD/MIPS to pass down the correct ABI, architecture and PIC flag. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196720 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Tools.cpp | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index a14a41914d..27170bd7d7 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -6026,11 +6026,38 @@ void netbsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back(Args.MakeArgString("-mcpu=" + MArch)); } - // Set byte order explicitly - if (getToolChain().getArch() == llvm::Triple::mips) - CmdArgs.push_back("-EB"); - else if (getToolChain().getArch() == llvm::Triple::mipsel) - CmdArgs.push_back("-EL"); + if (getToolChain().getArch() == llvm::Triple::mips || + getToolChain().getArch() == llvm::Triple::mipsel || + getToolChain().getArch() == llvm::Triple::mips64 || + getToolChain().getArch() == llvm::Triple::mips64el) { + StringRef CPUName; + StringRef ABIName; + getMipsCPUAndABI(Args, getToolChain().getTriple(), CPUName, ABIName); + + CmdArgs.push_back("-march"); + CmdArgs.push_back(CPUName.data()); + + CmdArgs.push_back("-mabi"); + CmdArgs.push_back(getGnuCompatibleMipsABIName(ABIName).data()); + + if (getToolChain().getArch() == llvm::Triple::mips || + getToolChain().getArch() == llvm::Triple::mips64) + CmdArgs.push_back("-EB"); + else + CmdArgs.push_back("-EL"); + + Arg *LastPICArg = Args.getLastArg(options::OPT_fPIC, options::OPT_fno_PIC, + options::OPT_fpic, options::OPT_fno_pic, + options::OPT_fPIE, options::OPT_fno_PIE, + options::OPT_fpie, options::OPT_fno_pie); + if (LastPICArg && + (LastPICArg->getOption().matches(options::OPT_fPIC) || + LastPICArg->getOption().matches(options::OPT_fpic) || + LastPICArg->getOption().matches(options::OPT_fPIE) || + LastPICArg->getOption().matches(options::OPT_fpie))) { + CmdArgs.push_back("-KPIC"); + } + } Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler); -- 2.40.0