Create one literal pool per function, so that literal pool data is removed
together with a function, if it is not used. Literal storage can now be controlled by #pragma writable-strings on a per function basis. git-svn-id: svn://svn.cc65.org/cc65/trunk@4499 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -244,7 +244,7 @@ Here is a description of all the command line options:
|
||||
better way is to declare characters explicitly as "signed" if needed. You
|
||||
can also use <tt><ref id="pragma-signed-chars"
|
||||
name="#pragma signed-chars"></tt> for better control of this option.
|
||||
|
||||
|
||||
|
||||
<label id="option--standard">
|
||||
<tag><tt>--standard std</tt></tag>
|
||||
@@ -300,7 +300,9 @@ Here is a description of all the command line options:
|
||||
<tag><tt>--writable-strings</tt></tag>
|
||||
|
||||
Make string literals writable by placing them into the data segment instead
|
||||
of the rodata segment.
|
||||
of the rodata segment. You can also use <tt><ref id="pragma-writable-strings"
|
||||
name="#pragma writable-strings"></tt> to control this option on a
|
||||
per function basis.
|
||||
|
||||
|
||||
<label id="option-static-locals">
|
||||
@@ -975,6 +977,26 @@ parameter with the <tt/#pragma/.
|
||||
#pragma warn (unused-param, pop)
|
||||
</verb></tscreen>
|
||||
|
||||
<sect1><tt>#pragma writable-strings ([push,] on|off)</tt><label id="pragma-writable-strings"><p>
|
||||
|
||||
Changes the storage location of string literals. For historical reasons,
|
||||
the C standard defines that string literals are of type "char[]", but
|
||||
writing to such a literal causes undefined behaviour. Most compilers
|
||||
(including cc65) place string literals in the read-only data segment, which
|
||||
may cause problems with old C code that writes to string literals.
|
||||
|
||||
Using this pragma (or the corresponding command line option <tt/<ref
|
||||
name="--writable-strings" id="option-writable-strings">/) causes the
|
||||
literals to be placed in the data segment so they can be written to without
|
||||
worry.
|
||||
|
||||
Please note that the value of this flag that is in effect when a function
|
||||
is encountered, determines where the literals are stored. Changing the
|
||||
<tt/#pragma/ within a function doesn't have an effect for this function.
|
||||
|
||||
The <tt/#pragma/ understands the push and pop parameters as explained above.
|
||||
|
||||
|
||||
<sect1><tt>#pragma zpsym (<name>)</tt><p>
|
||||
|
||||
Tell the compiler that the -- previously as external declared -- symbol with
|
||||
|
||||
Reference in New Issue
Block a user