-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert "Make: use gcc as LD" #3900
Conversation
Yes, it's a little bit confusing, but if you want to enable LTO, you must use gcc to drive the link process as far as I know. If we can't find a method to let ld work with LTO, it's better to keep the change as it.
|
Agreed that Link Time Optimization would be a good thing to make a reality, if possible. We may run into some additional fallout from the 45672c2 change, like what happened with clang (fixed in #3904). But so far it looks good. |
https://github.com/torvalds/linux/blob/009c9aa5be652675a06d5211e1640e02bbb1c33d/Makefile#L920 |
i played a bit with LTO. also, it seems gcc folks are thinking ld should work. my impression is that it isn't a good idea to use LD=cc for the LTO purpose either. |
Linux Kernel support LTO with Clang-only so far, and using the LLD, which is the LLVM linker.
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?
I understand that a future support for LTO should not be the sole reason for that decision, and I agree that removing |
yes.
have you looked at the example i provided?
|
I have no opinion if this should be reverted or not, but doing changes like this repeatedly is hard for commercial users because all out-of-tree board Make.defs files needs to be modified every single time when something like this is either applied or reverted. At least the -Wl, should have been expanded from make variable, say $(LDFLAGPREFIX), so that changing between gcc and ld does not need to touch so many files again. |
I agree that we should not cause a lot of additional work to downstream users.
I think that is a good idea. The good news is: although #3836 is on master, it has not been released. A make variable could be added now. Commercial users who work with official releases will only have to make 1 change, not 2, if we do it now, before the next release. (Users who track master are sure to experience a bumpy road no matter what, so if they've updated their boards already, they will have to do it again; but this could be easier than the first time because the diff of the 1st change will show them exactly where to make the 2nd change.) |
my suggestion is
|
@xiaoxiang781216 @gustavonihei |
I am fine with either approach, but could you incorporate your LTO demo into mainline? Otherwise, the same change may be created again for LTO. |
maybe i will try. |
@gustavonihei was your opinion? |
My opinion is somewhat like yours, I am fine either way. |
@xiaoxiang781216 @gustavonihei i haven't found a chance to investigate the lto things. |
btw, i updated my demo to use a library. it seems working for both of gcc and clang so far. |
@xiaoxiang781216 @gustavonihei @AlexanderVasiljev are we going to have more PRs like #4173? Otherwise we should merge this one, it's been sitting here for a while. |
… Clang" This reverts commit ba1f730.
…ld to gcc": This reverts commit 6545b95.
This reverts commit 45672c2. Because: * It's very confusing to have cc as LD. * I don't see what "-nostartfiles -nodefaultlibs" in LDFLAGS are supposed to do when we use LD directly. It would be simpler to remove them from our LDFLAGS.
Remove -Wl, in LDFLAGS.
These options are not ld options. The recent versions of ld complain on them. https://sourceware.org/pipermail/binutils/2021-June/116826.html
…ilds" This reverts commit 6c2c70c.
@gustavonihei and @Ouss4 how about we merge this PR? because using gcc as ld doesn't work well with clang toolchain. I can provide lto demo with ld after this PR merge. |
@yamt @xiaoxiang781216 please take a look, this Revert brought back an old issue, now all ARM and MIPS boards are breaking because of it:
"arm-none-eabi-ld: Error: unable to disambiguate: -nostartfiles (did you mean --nostartfiles ?)" As @hartmannathan reported here #3209 it will happen if "Binutils is updated to 2.36.x". So probably our CI is using an old version and the problem doesn't show up. |
I thought about the idea of going ahead and removing "-nostartfiles -nodefaultlibs" from all LDFLAGS, but we cannot do it without double check each toolchain. For example:
This is a toolchain that use to be very outdated and removing those flags could bring unexpected results. |
On Sat, Sep 11, 2021 at 4:31 PM Alan Carvalho de Assis < ***@***.***> wrote:
@yamt <https://github.com/yamt> @xiaoxiang781216
<https://github.com/xiaoxiang781216> please take a look, this Revert
brought back an old issue, now all ARM and MIPS boards are breaking because
of it:
LDFLAGS += -nostartfiles ...
"arm-none-eabi-ld: Error: unable to disambiguate: -nostartfiles (did you
mean --nostartfiles ?)"
As @hartmannathan <https://github.com/hartmannathan> reported here #3209
<#3209> it will happen if
"Binutils is updated to 2.36.x". So probably our CI is using an old version
and the problem doesn't show up.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3900 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOD4O5ZXWNJNAKYGDKDMUW3UBO4BDANCNFSM46PSFL7A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
In the CWIKI, I wrote a more detailed explanation:
https://cwiki.apache.org/confluence/display/NUTTX/NuttX+10.2?desktop=true
¯oName=markdown#ld-now-called-through-gcc
|
Summary
This reverts commit 45672c2.
Because:
supposed to do when we use LD directly. It would be simpler to
remove them from our LDFLAGS.
Impact
Testing