gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

C/C++ > Pool Problem

#2406 - punchy - Mon Feb 03, 2003 5:26 am

Hi,
i'm getting the following error message when i try to compile:

"cckX7XjN.s:104310: Error: invalid literal constant: pool needs to be closer"

Anyone got any ideas?

Thanks.

#2407 - tepples - Mon Feb 03, 2003 5:49 am

punchy wrote:
"cckX7XjN.s:104310: Error: invalid literal constant: pool needs to be closer"

Anyone got any ideas?

I'd take a wild guess that this can happen when you're compiling either a function that's too big or a C source file that's too big. Because immediate values on the ARM architecture have so few bits, it can't use a "load 16 bits into high half of register, then OR 16 bits into low half of register" instruction sequence as used in MIPS (lui/or) or PowerPC. Thus, the ARM architecture stores large constant values in a "pool" after each function and uses 'ldr' instructions with program counter relative addressing to load constants from this pool.

Apparently, if GCC can't put the pool close enough to the code, the assembler will complain. I can see how this would happen in theory for a large function.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#2443 - punchy - Tue Feb 04, 2003 2:09 am

Rewritting the function to make it smaller did indeed solve the problem.

Cheers.