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
-nostartfiles is not an LDFLAG #127
Comments
Hi, I am using this GCC version I do not see this warning. How did you hit this problem ? |
According to GCC documentation I see this parameter is available for the linker |
I'm sorry, this is actually caused by binutils version 2.36. The 10.2.1 GCC ARM toolchain you are using shipped with binutils version 2.35.1. arm-none-linux-gnueabihf-ld is just an alias for the binutils ld executable. They have identical sha256 hashes: What -nostartfiles is actually doing is: I tried to remove the -nostartfiles from the makefile to see if it changed anything in the map file when compiling with the 10.2.1 GCC ARM Toolchain, but I discovered that if I touch the Makefile at all (even just adding a comment) that the output map file changed on me. Not sure what's causing that yet, but it makes it hard to compare the differences with and without the flag. If I use a Makefile with an extra comment line, there doesn't appear to be a difference in the map files generated with and without the -nostartfiles. |
Oh. The difference in the map files was being generated by the addition of a '-dirty' statement to the DAT91BOOTSTRAP_VERSION. Once it was made to always be dirty, there was no apparent difference with and without the -nostartfiles when using GCC 10.2.1 / Binutils 2.35.1. If using Binutils 2.36.1 with their improved flag parsing, the link will fail due to -nostartfiles being an invalid flag. |
I believe the purpose of the -nostartfiles is to stop the toolchain from actually using start files . Thanks for shedding some light on this. |
I don't think -nostartfiles is needed at all. It's intended to be used when using gcc as the final linker: Instead this project is calling the binutils linker and telling it exactly what objects to include: |
@nirvann Hi, what's your take on this one ? As you have tested bootstrap on various platforms and toolchains. |
Hi, I didn't met the linker error message either. This |
@celledge Do you wish to make a patch for this, or you wish me to do it ? Thanks ! |
Binutils linker ld does not support the flag -nostartfiles. This is interpreted as "-n -o startfiles" which fortunately has no impact on the build process. Removing -nostartfiles has no impact on the build. Binutils 2.36 and later ld has improved flag parsing and throws an error if -nostartfiles is passed as an argument. Removing the flag fixes the problem. Details on the Binutils ML: https://sourceware.org/pipermail/binutils/2021-June/116826.html resolves linux4sam#127
@ehristev Is this pull request sufficient or do you need anything else? |
Yes it's fine. I will apply this soon. |
Fixed by applying patch. Thanks again ! |
Could you make a new release of at91bootstrap 3.x with this fix? Thanks! |
AT91Bootstrap 3.10.2 has a bug in its Makefile:[1] it gives the -nostartfiles flag to the ld command, although this is a gcc flag, not an ld flag. The bug happens to be harmless when using binutils 2.35. However, the ld shipped with binutils 2.36 is more strict in its option parsing, and fails with the following error: .../output/host/bin/arm-buildroot-linux-uclibcgnueabihf-ld: Error: unable to disambiguate: -nostartfiles (did you mean --nostartfiles ?) The bug was fixed upstream in commit 3207586a.[2] However, since there has been no tagged 3.x release since then, we just upgrade to the current head of the branch at91bootstrap-3.x. Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/1478738145 https://gitlab.com/buildroot.org/buildroot/-/jobs/1478738152 [1] linux4sam/at91bootstrap#127 [2] linux4sam/at91bootstrap@3207586 Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
3.10.3 tagged and pushed. |
Newer version of GCC (10.2.0 tested) have added extra error checking to the LD linker. If you now pass a flag that it doesn't recognize it will suggest an alternative. Additionally
-nostartfiles
is a GCC flag, not a LD flag. Together this causes the at91bootstrap make file to generate a linking error:arm-poky-linux-gnueabi-ld: Error: unable to disambiguate: -nostartfiles (did you mean --nostartfiles ?)
Explanation available here:
https://sourceware.org/pipermail/binutils/2021-June/116826.html
I think
-nostartfiles
was just silently ignored previously.The text was updated successfully, but these errors were encountered: