yamt commented on pull request #3900:
URL: https://github.com/apache/incubator-nuttx/pull/3900#issuecomment-861044754


   > > * iirc, linux supports LTO with ld. can you explain why it doesn't work 
for us?
   > 
   > Linux Kernel support LTO with Clang-only so far, and using the LLD, which 
is the LLVM linker.
   
   yes.
   
   > 
   > > also, it seems gcc folks are thinking ld should work.
   > > http://gcc.gnu.org/wiki/whopr/driver
   > 
   > I believe that wiki page might not be up-to-date, since it is already a 
bit old. Is there a specific detail from this guide you'd like to bring to the 
discussion?
   > If you look at the documentation for the `-flto` flag, it is clearly 
stated that:
   > 
   > > _The important thing to keep in mind is that to enable link-time 
optimizations you need to use the GCC driver to perform the link step_
   > 
   > 
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#:~:text=the%20important%20thing%20to%20keep%20in%20mind%20is%20that%20to%20enable%20link-time%20optimizations%20you%20need%20to%20use%20the%20gcc%20driver%20to%20perform%20the%20link%20step.
   
   have you looked at the example i provided?
   https://github.com/yamt/garbage/tree/master/lto
   it includes gcc. to me it looks working as documented in the wiki.
   
   > 
   > > * anyway, LTO thing is a bit off-topic. the change in question was to 
fix #3826 and my point is that it doesn't seem like an appropriate fix.
   > 
   > I understand that a future support for LTO should not be the sole reason 
for that decision, and I agree that removing `-nostarfiles` and 
`-nodefaultlibs` is also a solution for the issue #3826.
   > But I don't see why the implemented solution is not appropriate. It indeed 
fixes the issue and it has the advantage of setting up the build system for a 
future improvement.
   
   * as i stated, using cc as LD is very confusing. if you really want to use 
cc for linking, it's better to use CC. in some places we already do that. (grep 
CCLINKFLAG)
   * do you have a POC patch to enable LTO that way? otherwise the "setting up 
the build system for a future improvement" sounds moot.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to