Hi all,

Is there any way to change the compilation of a declaration?
char *s = "abc";
compiled into
       .section .rodata
.LCO:
       .ascii "abc\0";
       .section .data
       .align 1
_s:
       .long .LCO
I would like to change the last line in the above generated code. What
is the hook which can help us to do that?

Thank you for any help.
Phung

On Mon, Oct 18, 2010 at 9:50 AM, Phung Nguyen <nhph...@gmail.com> wrote:
> Hi all,
>
> When compiling a C code containing a global declaration like:
> char *s = "abc";
> The assembly code will be
>        .section .rodata
>
> .LC0:
>        .ascii "abc\0"
>        .section .data
>        .align 1
> _s:
>        .long   .LC0
> where the real address of string constant is kept in _s. However, in
> the processor I am porting GCC to, there is a memory mode, data page
> mode, which combines 14 LSB of the first word with 10LSB of the second
> word to make a read address. So, how to make GCC generates for _s
> like:
> _s:
>
>      .int POF:.LCO
>      .int PAG:.LCO
> and how to make assembler or linker accepts such an initialization.
> The assembler can accept the prefix POF and PAG now if they are in the
> assembly code like
> mov r2, PAG:_s
> mov r3,POF:_s
> but it cannot accept such a prefix in the initialization.
>
> Best regards,
> Phung
>

Reply via email to