xtensa: add config option to enable longcalls option
PATCH v2 1/1 xtensa: add config option to enable longcalls option
The longcalls option allows calls across a greater range of addresses.
This option should be used when call targets can potentially be out of range. It may degrade both code size and performance, but the linker can generally optimize away the unnecessary overhead when a call ends up within range.
This option is enabled by default.
--- arch/Config.in.xtensa | 17 +++++++++++++++++ package/Makefile.in | 6 ++++++ 2 files changed, 23 insertions(+)
arch/Config.in.xtensa +17 -0
@@ -35,3 +35,20 @@ config BR2_XTENSA_OVERLAY_DIR config BR2_ARCH default "xtensa" if BR2_xtensa + +menu "Target build options" + +config BR2_XTENSA_LONGCALLS + bool "Enable longcalls option" + default y + help + Enable or disable transformation of call instructions to allow + calls across a greater range of addresses. + This option should be used when call targets can potentially be + out of range. It may degrade both code size and performance, but + the linker can generally optimize away the unnecessary overhead + when a call ends up within range. + + Should be enabled by default. + +endmenu
package/Makefile.in +6 -0
@@ -56,6 +56,12 @@ TARGET_ABI+=-mabi=spe -mfloat-gprs=double -Wa,-me500mc endif endif +# Xtensa: The 'longcalls' option is required for large binary packages. +# Use a global option for all packages for now. +ifeq ($(BR2_XTENSA_LONGCALLS),y) +TARGET_CFLAGS += -mlongcalls +endif + STAGING_DIR=$(HOST_DIR)/usr/$(GNU_TARGET_NAME)/sysroot TARGET_OPTIMIZATION:=$(call qstrip,$(BR2_TARGET_OPTIMIZATION))
Signature · 1 line
1.7.9.5
PATCH v2 1/1 xtensa: add config option to enable longcalls option
Dear Chris Zankel,
Quoted 30 lines · Chris Zankel
The longcalls option allows calls across a greater range of addresses.
This option should be used when call targets can potentially be out of range. It may degrade both code size and performance, but the linker can generally optimize away the unnecessary overhead when a call ends up within range.
This option is enabled by default.
Signed-off-by Chris Zankel <[email protected]>--- arch/Config.in.xtensa | 17 +++++++++++++++++ package/Makefile.in | 6 ++++++ 2 files changed, 23 insertions(+)arch/Config.in.xtensa +7
-0@@ -35,3 +35,20 @@ config BR2_XTENSA_OVERLAY_DIR config BR2_ARCH default "xtensa" if BR2_xtensa + +menu "Target build options" + +config BR2_XTENSA_LONGCALLS + bool "Enable longcalls option" + default y + help
arch/Config.in.xtensa config BR2_XTENSA_OVERLAY_DIR · line 54
Quoted 10 lines
arch/Config.in.xtensa +10
-0+ Enable or disable transformation of call instructions to allow + calls across a greater range of addresses. + This option should be used when call targets can potentially be + out of range. It may degrade both code size and performance, but + the linker can generally optimize away the unnecessary overhead + when a call ends up within range. + + Should be enabled by default. + +endmenu
Do we really want that as a configurable option? Isn't it possible instead to always generate longcalls, or to fix this on a per-package basis, when needed?
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v2 1/1 xtensa: add config option to enable longcalls option
Quoted 5 lines · Thomas Petazzoni
Dear Chris Zankel,
Quoted 2 lines · Chris Zankel
The longcalls option allows calls across a greater range of addresses.
Quoted 8 lines
Quoted 5 lines
This option should be used when call targets can potentially be out of range. It may degrade both code size and performance, but the linker can generally optimize away the unnecessary overhead when a call ends up within range.
Do we really want that as a configurable option? Isn't it possible instead to always generate longcalls, or to fix this on a per-package basis, when needed?
The actual distance between call and destination is probably very dependent on compiler versions and compile options, etc., so might be hard to figure out what packages are affected. We might end up with a lot of packages with special Xtensa 'treatments'. Probably better to just have it always there.
It should actually be fine to always compile with the longcalls option, but I didn't just want to change it without having the option to keep the old behavior, hence the option.
Thanks,
-Chris
PATCH v2 1/1 xtensa: add config option to enable longcalls option
Quoted 8 lines · czankel
Quoted 3 lines
Do we really want that as a configurable option? Isn't it possible instead to always generate longcalls, or to fix this on a per-package basis, when needed?
The actual distance between call and destination is probably very dependent on compiler versions and compile options, etc., so might be hard to figure out what packages are affected. We might end up with a lot of packages with special Xtensa 'treatments'. Probably better to just have it always there.
Hum, right.
Quoted 3 lines
It should actually be fine to always compile with the longcalls option, but I didn't just want to change it without having the option to keep the old behavior, hence the option.
I'd prefer to have it always enabled, I'd say. We try to not add gazillions of very detailed architecture-specific options that are hard to understand. Hardcore users will know how/where to remove this option is they need, or they can even override it by passing a -mno-longcalls option in BR2_TARGET_OPTIMIZATION.
What do you think?
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v2 1/1 xtensa: add config option to enable longcalls option
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Hi,
Quoted 3 lines
Quoted 3 lines
It should actually be fine to always compile with the longcalls option, but I didn't just want to change it without having the option to keep the old behavior, hence the option.
Thomas> I'd prefer to have it always enabled, I'd say. We try to not add Thomas> gazillions of very detailed architecture-specific options that are Thomas> hard to understand. Hardcore users will know how/where to remove this Thomas> option is they need, or they can even override it by passing a Thomas> -mno-longcalls option in BR2_TARGET_OPTIMIZATION.
Thomas> What do you think?
I agree. Lets use the safe option by default.
Signature · 1 line
Bye, Peter Korsgaard
PATCH v2 1/1 xtensa: add config option to enable longcalls option
Hi,
Quoted 13 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Hi,
Quoted 3 lines
Quoted 3 lines
It should actually be fine to always compile with the longcalls option, but I didn't just want to change it without having the option to keep the old behavior, hence the option.
Thomas> I'd prefer to have it always enabled, I'd say. We try to not add Thomas> gazillions of very detailed architecture-specific options that are Thomas> hard to understand. Hardcore users will know how/where to remove this Thomas> option is they need, or they can even override it by passing a Thomas> -mno-longcalls option in
BR2_TARGET_OPTIMIZATION.
Quoted 4 lines
Thomas> What do you think?
I agree. Lets use the safe option by default.
Not sure what you mean with the 'safe option'? I'm also not sure what the preference for options is when you pass both, the -mlongcalls and -mno-longcalls option at the same time?
Anyway, I'm fine with whatever solution you come up with, as long as it makes it into the tree :-)
Thanks,
-Chris
PATCH v2 1/1 xtensa: add config option to enable longcalls option
Dear Chris Zankel,
Quoted 3 lines · Chris Zankel
Quoted 2 lines
I agree. Lets use the safe option by default.
Not sure what you mean with the 'safe option'? I'm also not sure what
I guess Peter means enabling "-mlongcalls" all the time. My understanding (and I think Peter did understand it the same way) is that if you build with -mlongcalls, then all binaries will work, both small and large binaries, even though there is a small size and performance cost.
So, what we propose is to simply make -mlongcalls part of the CFLAGS unconditionally in the Buildroot Xtensa support.
Quoted 2 lines
the preference for options is when you pass both, the -mlongcalls and -mno-longcalls option at the same time?
The last one takes precedence, I think.
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v2 1/1 xtensa: add config option to enable longcalls option
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Thomas> Dear Chris Zankel,
Quoted 3 lines · Chris Zankel
Quoted 3 lines
Quoted 2 lines
I agree. Lets use the safe option by default.
Not sure what you mean with the 'safe option'? I'm also not sure what
Thomas> I guess Peter means enabling "-mlongcalls" all the time. My Thomas> understanding (and I think Peter did understand it the same way) is Thomas> that if you build with -mlongcalls, then all binaries will work, both Thomas> small and large binaries, even though there is a small size Thomas> and performance cost.
Thomas> So, what we propose is to simply make -mlongcalls part of the CFLAGS Thomas> unconditionally in the Buildroot Xtensa support.
Indeed.
Signature · 1 line
Bye, Peter Korsgaard