I have to develop a research prototype where I want to avoid having the .rodata section. Is there any way of allocating string literals in .data instead?
Why do you want to do that?
Joerg
What I usually do in this kind of situation, is adapt the linker scripts to also collect ‘.rodata’ input sections into the ‘.data’ output section, for example by changing:
SECTIONS
{
…
.rodata 0 : { (.rodata .rodata.) }
.data 0 : { (.data .data.) }
…
}
to:
SECTIONS
{
…
/* .rodata 0 : { (.rodata .rodata.) } */
.data 0 : { (.data .data. .rodata .rodata.*) }
…
}
Alternatively, you could use ‘objcopy’ to rename the ‘.rodata’ sections to the equivalent ‘.data’ sections.
MartinO