benshi001 added inline comments.
================ Comment at: clang/lib/Driver/ToolChains/AVR.cpp:463 +std::string +AVRToolChain::buildCompilerRTBasename(const llvm::opt::ArgList &Args, + StringRef Component, FileType Type, ---------------- This method decides the file name of compiler-rt, it is expected to be libclang_rt.builtins-avrfamily.a, such as libclang_rt.builtins-avr51.a libclang_rt.builtins-avrtiny.a libclang_rt.builtins-avrxmega3.a ================ Comment at: clang/lib/Driver/ToolChains/AVR.cpp:482 + +std::string AVRToolChain::getCompilerRTPath() const { + // Return default path appended with "/avr", if it exists. ---------------- This method decides the library path of compiler-rt, it is `$(RESOURCE_DIR)/lib/avr` or `$(RESOURCE_DIR)/lib/`. The resource dir is either explicitly specified via user option `-resource-dir` or has default value `$(LLVM_INSTALL_DIR)/lib/clang/$(LLVM_VERSION)`. such as ``` /opt/avr-tool-chain/lib/clang/14.0.1/lib/avr /opt/avr-tool-chain/lib/clang/14.0.1/lib/ ``` ================ Comment at: clang/lib/Driver/ToolChains/AVR.cpp:492 + +ToolChain::RuntimeLibType AVRToolChain::GetDefaultRuntimeLibType() const { + return GCCInstallation.isValid() ? ToolChain::RLT_Libgcc ---------------- Currently we still use libgcc if --rtlib option is not specified. ================ Comment at: clang/lib/Driver/ToolChains/AVR.cpp:541 + assert( + (RtLib == ToolChain::RLT_Libgcc || RtLib == ToolChain::RLT_CompilerRT) && + "unknown runtime library"); ---------------- Currently we only allow --rtlib=libgcc and --rtlib=compiler-rt ================ Comment at: clang/lib/Driver/ToolChains/AVR.cpp:564 + if (RtLib == ToolChain::RLT_Libgcc) + CmdArgs.push_back(Args.MakeArgString("-L" + TC.getGCCInstallPath() + + "/" + SubPath)); ---------------- If --rtlib is not specified or specified to libgcc, then we generate -L$PATH_TO_LIBGCC ================ Comment at: clang/lib/Driver/ToolChains/AVR.cpp:595 + // Link to libgcc. + if (RtLib == ToolChain::RLT_Libgcc) + CmdArgs.push_back("-lgcc"); ---------------- If --rtlib is not specified or specified to libgcc, then we generate -lgcc ================ Comment at: clang/lib/Driver/ToolChains/AVR.cpp:608 + // Link to compiler-rt. + if (RtLib == ToolChain::RLT_CompilerRT) { + std::string RtLib = ---------------- If --rtlib=compiler-rt is explicitly specified, we directly put the libclang.builtins-avrxxx.a as input file, other than -lclang.builtins-avrxxx, this is a tradition from other platforms, such as x86 and arm. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126299/new/ https://reviews.llvm.org/D126299 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits