arm thumb veneer question

Nicolas Pitre nicolas.pitre at linaro.org
Tue Sep 21 22:32:53 BST 2010


On Tue, 21 Sep 2010, Wolfgang Denk wrote:

> Is there any information available about relative code sizes /
> performance numbers of "--emit-relocs" versus "--use-blx"?

The blx instruction will always win on both counts: it is smaller and 
faster than a veneer.

> BTW: why does nobody answer my questions?
> 
>         Can anybody shed some light on 1) when these routines have
>         been introduced ... ?

The "veneers" are just code stubs that the linker automatically insert 
into the final binary in order to work around some incompatibility 
issues.

For example, if one of your .o file contains the following instruction:

	bl	foobar

During the link phase the linker may realize that the foobar function is 
too far away from the call site above (the bl instruction is relative to 
the current pc and has a limited range). In that case the linker has two 
choices: abort the link, or append to your .o this code:

foobar_veneer:
	ldr	pc, pc, #-4	/* pc is always 8 bytes ahead */
	.word	foobar

and then the "bl foobar" is modified to branch to foobar_veneer instead 
in order to produce an absolute call.

Those veneers are also used for other things, such as ARM vs Thumb 
interworking issues such as the one in this thread.

>         Is the specific tool chain in question available somewhere
>         for testing?

As far as I know, any reasonably recent toolchain (e.g. like toolchains 
released even 2 years ago) will emit veneers when required.


Nicolas



More information about the linaro-toolchain mailing list