This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: arm/thumb bugs


Adrian von Bidder wrote:

>  - in very big functions with long case statements, I get 'Branch out of
> range' when compiling for thumb with -fpic. I'm attempting to fix this,
> only I have no idea where to start - any hints? - since I don't know any
> workaround.

Quite helpless on this... I hoped I would find something looking hard at
gcc source, but to no avail...

I thought about tinkering with CASE_VECTOR_MODE, but I don't think it's
the right way. (And I would have no idea what mode to use...)

The switch statements translate to code like
.LCB6:
        ldr     r2, .L20
        lsl     r3, r3, #2
        ldr     r0, [r3, r2]
        mov     pc, r0
        .align  2
        .align  2
.L18:
        b       .L3
        b       .L10
	...

when compiling with -fpic. On thumb, the branch only takes +/- 2040
bytes as addresses, so branches out of that range are generated quite
fast in big functions.

Any help available at all?

greets from Zürich
-- vbi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]