]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc: Keep const vars out of writable .sdata
authorSegher Boessenkool <segher@kernel.crashing.org>
Thu, 1 Mar 2018 01:02:49 +0000 (17:02 -0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 5 Mar 2018 22:21:21 +0000 (09:21 +1100)
commitb2cb56c236afdf5d7c172d403ada61e1bbbe68ee
tree0d047444b749a85aa45b8aec8246dae5122319b1
parent23acbe6adfc22df6eedfea082ac4ed5cf4d73272
powerpc: Keep const vars out of writable .sdata

Newer gcc will support "-mno-readonly-in-sdata"[1], which makes sure that
the optimization on PPC32 for variables getting moved into the .sdata
section will not apply to const variables (which must be in .rodata).

This was originally noticed in mm/rodata_test.c when rodata_test_data
was not static:

c0695034 g     O .data 00000004 rodata_test_data

After this patch with an updated compiler, this is correctly in .rodata.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82411

Reported-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/Makefile