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]
Other format: [Raw text]

Re: CONSTANT_POOL_BEFORE_FUNCTION has no effect in tm.h?


Trevor Scroggins <trevor.scroggins@gmail.com> writes:

> What I'd like to do is place all constant and read-only data, which I
> now think means all data affected by CONSTANT_POOL_BEFORE_FUNCTION and
> READONLY_DATA_SECTION_ASM_OP (and others?); however, I'd like local,
> read-only data--strings and whatnot--to stay in .text, stored after
> the function rather than prior to it. More specifically, the data
> should be stored in a location appropriate for the addressing mode, as
> long as that location is not before the first instruction in .text.
> e.g.:
>
>         .text
> # NOT HERE
>         .even
>         .globl        _main
> _main:
>         ...
>         rts
> # HERE
> LC0:
>         .ascii "this is a string\0"
> LC1:
>         .ascii "this is another string\0"
>
> Will I need to "optimize" the location of the data myself?

Most targets put constant strings and the like in the .rodata section.
Then the linker script can put that in a useful place.  That seems like
the best approach to use for a processor like m68k which supports
general addressing.  I'm surprised that doesn't happen already.  I
assume you are using an ELF target, in which case I would expect
default_elf_select_rtx_section to do the right thing.

Ian


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