This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] [RFC] rs6000: -mreadonly-in-sdata (PR82411)
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Kees Cook <keescook at google dot com>
- Cc: gcc-patches at gcc dot gnu dot org, dje dot gcc at gmail dot com, Kees Cook <kees at outflux dot net>
- Date: Wed, 28 Feb 2018 18:39:19 -0600
- Subject: Re: [PATCH] [RFC] rs6000: -mreadonly-in-sdata (PR82411)
- Authentication-results: sourceware.org; auth=none
- References: <61d0d76104e9cee5a413ae050772870bcb47d49e.1519768361.git.segher@kernel.crashing.org> <CAGXu5jK7vKFPGNxjspdOYofg0DPRVdFcDpMvXvsRMH=b=XMzCQ@mail.gmail.com> <20180228232334.GE21977@gate.crashing.org> <CAGXu5j+aJLpYmbA+nq+oSaby0neBk9gN=buoZLwreakcJqaOWg@mail.gmail.com>
On Wed, Feb 28, 2018 at 04:15:23PM -0800, Kees Cook wrote:
> On Wed, Feb 28, 2018 at 3:23 PM, Segher Boessenkool
> <segher@kernel.crashing.org> wrote:
> > I'm trying to figure out how to get that file to build at all :-)
> $ CROSS_COMPILE=powerpc-linux-gnu- ARCH=powerpc make wii_defconfig
> $ for i in CONFIG_STRICT_KERNEL_RWX \
> CONFIG_DEBUG_KERNEL \
> CONFIG_DEBUG_RODATA_TEST ; do
> CROSS_COMPILE=powerpc-linux-gnu- ARCH=powerpc ./scripts/config -e $i
> done
I use ppc6xx_defconfig normally; I had to disable CONFIG_HIBERNATION
as well.
Without the new flag, rodata_test_data ends up in .sdata in the object
file and in .data in vmlinux.
Adding
===
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index ccd2556..31b9613 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -143,6 +143,8 @@ CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=med
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 $(MULTIPLEWORD)
+CFLAGS-$(CONFIG_PPC32) += $(call cc-option,-mno-readonly-in-sdata)
+
ifeq ($(CONFIG_PPC_BOOK3S_64),y)
CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,-mtune=power4)
CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power4
===
it ends up in .rodata in both.
It would be nice to have a more comprehensive test, but this will do; I'll
commit it tomorrow (will resend, with doc and changelog and all that).
Cheers,
Segher