================ @@ -490,6 +490,35 @@ void tools::AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, else A.renderAsInput(Args, CmdArgs); } + if (const Arg *A = Args.getLastArg(options::OPT_fveclib)) { + const llvm::Triple &Triple = TC.getTriple(); + StringRef V = A->getValue(); + if (V == "ArmPL" && (Triple.isOSLinux() || Triple.isOSDarwin())) { + // To support -fveclib=ArmPL we need to link against libamath. + // Some of the libamath functions depend on libm, at the same time, + // libamath exports its own implementation of some of the libm + // functions. Since here we are interested only in the subset of + // libamath functions that is covered by the veclib mappings, + // we need to do the following: + // + // 1. On Linux, link only when actually needed. + // + // 2. Prefer libm functions over libamath. + // + // 3. Link against libm to resolve libamath dependencies. + // + if (Triple.isOSLinux()) { + CmdArgs.push_back(Args.MakeArgString("--push-state")); + CmdArgs.push_back(Args.MakeArgString("--as-needed")); + } + CmdArgs.push_back(Args.MakeArgString("-lm")); ---------------- MaskRay wrote:
why -m -lamath -lm ? if there is circular dependency, the conventional way is --start-group -lamth -lm --end-group https://github.com/llvm/llvm-project/pull/116432 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits