--string_literal_pools, --no_string_literal_pools
Controls whether the compiler places string constants in literal pools.
With the --string_literal_pools
option, where there are string
literals in source code, the compiler usually places the character data in a literal
pool:
** Section #1 '.text' (SHT_PROGBITS) [SHF_ALLOC + SHF_EXECINSTR] Size : 32 bytes (alignment 4) Address: 0x00000000 $a .text main 0x00000000: e92d4010 .@-. PUSH {r4,lr} 0x00000004: e28f0008 .... ADR r0,{pc}+0x10 ; 0x14 0x00000008: ebfffffe .... BL puts 0x0000000c: e3a00000 .... MOV r0,#0 0x00000010: e8bd8010 .... POP {r4,pc} $d 0x00000014: 6c6c6548 Hell DCD 1819043144 0x00000018: 6f77206f o wo DCD 1870078063 0x0000001c: 00646c72 rld. DCD 6581362
The --no_string_literal_pools
option instructs the compiler to place string constants in a separate .conststring
or .constdata
section, and load the address of the character data from an integer literal pool, as follows:
** Section #1 '.text' (SHT_PROGBITS) [SHF_ALLOC + SHF_EXECINSTR] Size : 24 bytes (alignment 4) Address: 0x00000000 $a .text main 0x00000000: e59f000c .... LDR r0,[pc,#12] ; [0x14] = 0 0x00000004: e92d4010 .@-. PUSH {r4,lr} 0x00000008: ebfffffe .... BL puts 0x0000000c: e3a00000 .... MOV r0,#0 0x00000010: e8bd8010 .... POP {r4,pc} $d 0x00000014: 00000000 .... DCD 0 ** Section #4 '.conststring' (SHT_PROGBITS) [SHF_ALLOC + SHF_MERGE + SHF_STRINGS] Size : 12 bytes (alignment 4) Address: 0x00000000 0x000000: 48 65 6c 6c 6f 20 77 6f 72 6c 64 00 Hello world.
If you also specify the --no_integer_literal_pools
option, the
compiler constructs the address of the character data with a pair of
MOVW
/MOVT
instructions.
Default
The default is --string_literal_pools
.
--execute_only
implies --no_string_literal_pools
, unless --string_literal_pools
is explicitly specified.
--execute_only
in conjunction with --string_literal_pools
. If you do, then the compiler places the literal pool in an unreadable, execute-only code region.