Skip to content

Add --relax linker option #327

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matthijskooijman
Copy link
Collaborator

@matthijskooijman matthijskooijman commented Apr 2, 2020

This is currently automatically added by arduino-builder/arduino-cli,
but it should really be made explicit in the platform definition. This
allows removing it from arduino-cli later, see arduino/arduino-cli#639

This option tells the linker to replace "call" instructions by "rcall"
instructions where possible. This option was only automatically added
for the atmega2560, but it is actually useful for any ATmega with > 8K
flash (and a no-op for boards with <= 8K flash), so it can be added to
the commandline unconditionally.

This was tested on a Uno board (which saves a few bytes on the empty
sketch) and an Arduino NG with atmega8, which also accepts the option
but as expected it does not make a difference in sketch size.

Because this option is added at the end, it does not conflict with the
automatically added option (the linker commandline just gets
-Wl,--relax,--relax which works fine.

This is currently automatically added by arduino-builder/arduino-cli,
but it should really be made explicit in the platform definition. This
allows removing it from arduino-cli later, see

    arduino/arduino-cli#639

This option tells the linker to replace "call" instructions by "rcall"
instructions where possible. This option was only automatically added
for the atmega2560, but it is actually useful for any ATmega with > 8K
flash (and a no-op for boards with <= 8K flash), so it can be added to
the commandline unconditionally.

This was tested on a Uno board (which saves a few bytes on the empty
sketch) and an Arduino NG with atmega8, which also accepts the option
but as expected it does not make a difference in sketch size.

Because this option is added at the end, it does not conflict with the
automatically added option (the linker commandline just gets
`-Wl,--relax,--relax` which works fine.
@CLAassistant
Copy link

CLAassistant commented Apr 9, 2021

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants