https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63760

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|AVR                         |avr
           Priority|P3                          |P5

--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to Andreas Schwab from comment #1)
> Why aren't read-only data being placed in progmem by default?

Suppose

char func (const char *X)
{
    return *X;
}


Just that func does not alter *X does /not/ mean *X won't change in the
program.  It is completely legal for a program to use func like so:

void foo (char c)
{
    func (&c);
    c++;
    func (&c);
}

Hence the default linker description file locates .rodata in RAM and the
compiler may not assume data is located in flash just because a particular
function does not change it.

With a different ABI that reserved, e.g., Bit 15 of the address to tag whether
the object lives in .rodata or not, it would be possible to achieve this, but
it would also add quite some overhead to runtime and flash usage and pressure
on Z register like address space __memx does.

Reply via email to