[RFC PATCH v2] mvebu: compile the kernel in Thumb-2 mode for ARMv7 targets

Hauke Mehrtens hauke at hauke-m.de
Tue Jun 30 16:32:15 EDT 2020


On 6/18/20 3:16 PM, Rui Salvaterra wrote:
> (Sending as RFC due to the note below.)
> 
> The Thumb-2 instruction set generates denser code, allowing for more efficient
> use of the cache and consequently higher execution performance.

Did you run a benchmark to test how much faster it is?

> Vmlinux (uncompressed) size comparison for my personal configuration (Linux
> 5.4.46, compiled with gcc 9.3.0 and binutils 2.34):

Did you also tested this with the current default toolchain?
I would like to use binutils 2.34 as default soon, but gcc will probably
not be updated soon.

> 
> Pure ARM:
> 24243392 bytes
> 
> Thumb-2:
> 22102716 bytes
> 
> NOTE: This requires enabling a linker bug workaround to avoid the emission of
> R_ARM_THM_JUMP11 relocations [1] in modules, which the kernel doesn't support.
> Since this effectively implies -fno-optimize-sibling-calls [2], we're generating
> suboptimal code. While compat (and in-tree) modules load and run correctly
> without this workaround, WireGuard fails to load with an unknown relocation 102
> error.

Do you know if there is a fix for GNU gas available?

> 
> [1] https://static.docs.arm.com/ihi0044/e/IHI0044E_aaelf.pdf (page 28)
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm/Makefile?h=linux-5.4.y#n129
> 
> Signed-off-by: Rui Salvaterra <rsalvaterra at gmail.com>
> ---
>  target/linux/mvebu/cortexa9/config-5.4 | 2 ++
>  1 file changed, 2 insertions(+)
>  create mode 100644 target/linux/mvebu/cortexa9/config-5.4
> 
> diff --git a/target/linux/mvebu/cortexa9/config-5.4 b/target/linux/mvebu/cortexa9/config-5.4
> new file mode 100644
> index 0000000000..6aff77fda7
> --- /dev/null
> +++ b/target/linux/mvebu/cortexa9/config-5.4
> @@ -0,0 +1,2 @@
> +CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11=y
> +CONFIG_THUMB2_KERNEL=y
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20200630/98dc9897/attachment.sig>


More information about the openwrt-devel mailing list