[PATCH] D126192: [Driver] Support linking with lld for target AVR

Ben Shi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 26 21:33:06 PDT 2022


benshi001 marked 2 inline comments as done.
benshi001 added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/AVR.cpp:435
 
-  std::string Linker = getToolChain().GetProgramPath(getShortName());
+  // Compute the linker program path, and use GNU "avr-ld" as default.
+  const Arg* A = Args.getLastArg(options::OPT_fuse_ld_EQ);
----------------
MaskRay wrote:
> You can just call `ToolChain.GetLinkerPath()`. I don't think checking `can_execute` is necessary.
Thanks. This way makes my code more clear.


================
Comment at: clang/lib/Driver/ToolChains/AVR.cpp:530
+      if (AVRLibcRoot && FamilyName) {
+        std::string Prefix(*AVRLibcRoot + "/lib/ldscripts/");
+        if (llvm::sys::fs::is_directory(Prefix)) {
----------------
MaskRay wrote:
> I am concerned with the magic here. Shouldn't you let users specify explicit -T?
I have changed the logic to

1. Use the user specified linker script as first choice, and the entry point is expected to be specified in it.

2. Otherwise use default entry point (__vectors) and default linker script of avr-libc.
 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126192/new/

https://reviews.llvm.org/D126192



More information about the cfe-commits mailing list