2crypto: Force exported const arrays to .rodata
Unfortunately, there is no way to define really immutable data in the C
language. Making something 'const' is just a sign, not a cop, because in
theory any code can just cast the const away. Compilers instead use
sophisticated static analysis to determine what data is never written to
by the code and put that into the .rodata (instead of .data) section.
But for externally available global variables, they cannot do that
(because the analyzer doesn't cross compilation units).
Unfortunately some platforms in coreboot really care about everything
being in .rodata (because they're accessing it in-place on flash), and
some "benign" refactoring like making a const variable externally
available can break that. There is no easy fix for that. So in this
case, let's just go for the ugly fix of forcing the offending arrays
into the right section.
TEST=Built SIEMENS_MC_APL2 with CB:40503 and this patch.
Signed-off-by: Julius Werner <email@example.com>
Reviewed-by: Daisuke Nojiri <firstname.lastname@example.org>
1 file changed