This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: CONSTANT_POOL_BEFORE_FUNCTION has no effect in tm.h?
Trevor Scroggins <trevor.scroggins@gmail.com> writes:
> While I still think the choice is arbitrary (why the front and not the
> back--and mine's a lay opinion, I know), what's the generally accepted
> method for reorganizing string literals and other constants to appear
> after the function asm rather than before it? Some targets appear to
> do something similar in TARGET_MACHINE_DEPENDENT_REORG to relocate
> read-only data to a safe jump distance. Where should I begin looking
> in source/documentation to gain an understanding of the process?
I doubt that there is any documentation on this, but I'd be happy to be
surprised. TARGET_MACHINE_DEPENDENT_REORG is pretty much free to
rearrange things however it likes.
> Also, I don't really grok your example, which probably belies a lack
> of deep understanding of C or GCC or both. In every case I tried,
> 'const int ai[] = { 1 };' (and volatile ...) was translated to an
> immediate value of 1.
If you write
const int ai[] = { 1 };
int main() { }
then in some cases the global const variable will be put into the
readonly section of the object file before the function.
Ian