I'm receiving bug reports that some dynamically linked Newlib programs, compiled with vbcc, write the following messages into the serial debug log:
Code: Select all
[elf] .sdata 0x7fd55440-0x7fd55440
Projektit:Ohjelmointi/ScoreGen/ScoreGen/ScoreGen (sh_flags 0x02)
has read-only flag in section header
but is located in a read-write section of the program header
(linker (script) error?)
In my opinion the reason for it is that SDK/newlib/lib/startup.o doesn't include an .sdata section, although _SDA_BASE_ is referenced. Which means, when there is no small data in the main program, then vlink is forced to generate a dummy .sdata section to define _SDA_BASE_, as in the following fragment of Newlib's vbcc linker script:
Code: Select all
.sdata : {
_LinkerDB = . + 0x8000;
_SDA_BASE_ = . + 0x8000;
*(.sdata .sdata.* .tocd)
}
Unfortunately this dummy section is read-only, which causes the warning when the dynamic linker links a real read-write .sdata section to it.
It should be fixed in Newlib's startup.o or vbcc.ldscript. But both are not under my control. Can the responsible person please contact me by email to find a solution? Thanks in advance.