kconfig: linker: Add --no-relax build option
In some architectures the linker performs global optimization relaxing address modes and changing intructions in the output object file. This is a problem when userspace is enabled since it assumes that addresses won't change after certain build stage. In no supported architectures this option is ignored. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
92897ef011
commit
56ec06f344
3 changed files with 29 additions and 0 deletions
|
@ -292,6 +292,23 @@ config LINKER_LAST_SECTION_ID_PATTERN
|
||||||
be used.
|
be used.
|
||||||
The size of the pattern must not exceed 4 bytes.
|
The size of the pattern must not exceed 4 bytes.
|
||||||
|
|
||||||
|
config LINKER_USE_NO_RELAX
|
||||||
|
bool
|
||||||
|
help
|
||||||
|
Hidden symbol to allow features to force the use of no relax.
|
||||||
|
|
||||||
|
config LINKER_USE_RELAX
|
||||||
|
bool "Linker optimization of call addressing"
|
||||||
|
depends on !LINKER_USE_NO_RELAX
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
This option performs global optimizations that become possible when the linker resolves
|
||||||
|
addressing in the program, such as relaxing address modes and synthesizing new
|
||||||
|
instructions in the output object file. For ld and lld, this enables `--relax`.
|
||||||
|
On platforms where this is not supported, `--relax' is accepted, but ignored.
|
||||||
|
Disabling it can reduce performance, as the linker is no longer able to substiture long /
|
||||||
|
in-effective jump calls to shorter / more effective instructions.
|
||||||
|
|
||||||
endmenu # "Linker Sections"
|
endmenu # "Linker Sections"
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -28,4 +28,10 @@ macro(toolchain_ld_base)
|
||||||
${LINKERFLAGPREFIX},--sort-section=alignment
|
${LINKERFLAGPREFIX},--sort-section=alignment
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (NOT CONFIG_LINKER_USE_RELAX)
|
||||||
|
zephyr_ld_options(
|
||||||
|
${LINKERFLAGPREFIX},--no-relax
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
|
@ -26,4 +26,10 @@ macro(toolchain_ld_base)
|
||||||
${LINKERFLAGPREFIX},--sort-section=alignment
|
${LINKERFLAGPREFIX},--sort-section=alignment
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (NOT CONFIG_LINKER_USE_RELAX)
|
||||||
|
zephyr_ld_options(
|
||||||
|
${LINKERFLAGPREFIX},--no-relax
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue