Dear Dave Martin,
In message AANLkTikHv1SpjcyRbRxGK2QeCoq96tsTken3LmP5bsse@mail.gmail.com you wrote:
I believe such calls are getting resolved via a veneer because of a combination the thumb2-ness of libgcc and the toolchain being used.
In principle, the linker can know that it is linking for >= ARMv5T due to the way it was configured and the way the input objects were built, but GNU ld is conservative and doesn't do this automatically. As a result, it has to generate a veneer, reached via a normal non-interworking branch. ld has no way the veneer needs to be PIC and use the GOT, so it isn't and doesn't.
Stupid question: why not?
The `--use-blx' switch enables the linker to use ARM/Thumb BLX instructions (available on ARMv5t and above) in various situations. Currently it is used to perform calls via the PLT from Thumb code using BLX rather than using BX and a mode-switching stub before each PLT entry. This should lead to such calls executing slightly faster.
...so you might explicitly want to enable this whenever building for ARMv5 or later.
Wolfgang, can you foresee any reason not to do that? As far as I can see it will be safe so long as we don't use it when building for architectured <ARMv5 (where the BLX instruction isn't supported).
If care is taken that it causes no conflicts with older tool chains I'm happy with that. I guess that can be added to arch/arm/cpu/armv7/config.mk
Alternatively, using ld --emit-relocs and then embedding the relocation information in the image so that U-Boot can use it could help to solve the problem. I'm guessing that isn't set up at present, though.
Is there any information available about relative code sizes / performance numbers of "--emit-relocs" versus "--use-blx"?
- is there an option for the toolchain to use an arm libgcc instead of thumb?
You'd need to rebuild the toolchain (or at least libgcc). I believe that no ARM libgcc is built at present for the linaro/Ubuntu tools. I don't think the GCC packages currently support this kind of thing well.
I think that should be fixed. I guess you will run intot hat again sooner or later.
BTW: why does nobody answer my questions?
Can anybody shed some light on 1) when these routines have been introduced ... ?
Is the specific tool chain in question available somewhere for testing?
Best regards,
Wolfgang Denk