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?

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.

Trev

On Mon, Jul 6, 2009 at 11:45 AM, Ian Lance Taylor<i...@google.com> wrote:
> Trevor Scroggins <trevor.scrogg...@gmail.com> writes:
>
>> No, that won't work. The assembler only recognizes .text, .data, and
>> .bss and doesn't support .section. Surely there's a simple hook that
>> instructs that compiler to print locals after a function instead of
>> before it?
>
> No.  Why should there be?  Even if you fix the case of string constants,
> you will run into trouble as soon as somebody writes
>    const int ai[] = { 1 };
>
> Most systems require some sort of startup code to run before main,
> anyhow.  If you have no such requirement, then I recommend simply being
> disciplined in how you write the "main" function, or paying the cost of
> two or four initial bytes to branch to the main function from the start
> of the .text section.
>
> Ian

Reply via email to