-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
-Wl,-gc-sections
linker switch is never included
#1811
Comments
-Wl,-gc-sections
as linker switch to the generated GPR for binary crates-Wl,-gc-sections
linker switch is never included
@Fabien-Chouteau do you have input on this? I haven't used these switches deliberately in recent memory. |
Is there a use case for these switches except on resource-constrained embedded systems? I write as a Mac user, where the GNU ld option
so for me (On the other hand, |
The list of switches generated by Alire are compiler switches not linker switches. We could change the |
|
@JeremyGrosser : my embedded projects use |
Same experience about debugging. But this seems to depend on debug format (from GCC documentation):
Something like this could be generated by default: package Linker is
case Your_Crate_Config.Alire_Host_OS is
when "macos" =>
Linker_Options := ();
when others =>
Linker_Options := ("-Wl,-gc-sections");
end case;
for Default_Switches ("Ada") use Linker_Options;
end Linker; It could also take |
@JeremyGrosser It's probably something else because, like @simonjwright, I never had an issue with debugging and these options. Also, the documentation clearly says it's for "eliminating the unused code and data": https://gcc.gnu.org/onlinedocs/gnat_ugn/Compilation-options.html @mgrojo Indeed, we could do something like this. Although I am not a huge fan of adding more complexity to the non-generate project files, another option would be to have Alire generate Linker switches in addition to compiler switches. |
My opinion: none of these options should be used in Alire-generated project files. There could be a case for including them in embedded RTS’s |
Checklist
alr version
.Describe the bug
Alire includes these compiler switches in all its build profiles:
But it doesn't include
-gc-sections
to the linker in any of the profiles. Can that be considered a bug, or is there a reason for that? As far as I know, these options only make sense when the linker performs garbage collection. The GCC documentation seems to suggest that you should use these options with care, and the GNAT documentation only mentions the compiler switches in combination to the linker switches.To Reproduce
Steps to reproduce the behavior:
alr init gc_sections
alr build -- -v
-ffunction-sections -fdata-sections
in the compilation command, but not-Wl,-gc-sections
in the linker command:Expected Behavior
-Wl,--gc-sections
is added to the default generated gpr file for binary crates, so that the other switches make something useful. Maybe could be done only in the release profile, but then, why to include the compilation switches in the other profiles?alr
versionThe text was updated successfully, but these errors were encountered: