[uclibc-ng-devel] [PATCH] arm: simplify handling of Thumb related options

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Sun Mar 20 17:47:04 UTC 2016


Hello,

Thanks for your feedback!

On Sun, 20 Mar 2016 13:40:40 -0400, Rich Felker wrote:
> On Sun, Mar 20, 2016 at 05:58:35PM +0100, Thomas Petazzoni wrote:
> > Currently, the Thumb support on ARM has three related Config.in
> > options, which are not trivial for users to understand, and are in
> > fact not needed:
> > 
> >  - The USE_BX option is not needed: knowing whether BX is available or
> >    not is easy. If you have an ARM > v4 or ARMv4T, then BX is
> >    available, otherwise it's not. This is the logic used in glibc.
> 
> This sounds correct.
> 
> >  - The USE_LDREXSTREX option is not needed: whenever Thumb2 is
> >    available, ldrex/strex are available, so we can simply rely on
> >    __thumb2__ to determine whether ldrex/strex should be used, without
> >    requiring a Config.in option.
> 
> __thumb2__ is sufficient for ldrex/strex but not sufficient; v6 has
> them in the arm isa.

I'm not sure what you mean between:

 (1) ldrex/strex are also available on plain ARMv6 (i.e not Thumb2).

 (2) ldrex/strex are not available on ARMv6, while some ARMv6 support
     Thumb2.

If you mean (1), then before my patch, the ldrex/strex code was only
enabled when USE_LDREXSTREX was enabled, and this option had a "depends
on COMPILE_IN_THUMB". Hence my patch doesn't change the fact that
the ldrex/strex logic is only used on Thumb. Whether it can/should be
enabled in non-Thumb configurations is a separate matter from what my
patch is doing.

If you mean (2), then there is indeed a problem. Though, according to
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/14979.html,
"On a v6 or later core (ARM11 onwards) you should use the LDREX/STREX
instructions instead", which would suggest that such instructions are
available.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


More information about the uClibc mailing list